You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2016/04/06 20:40:57 UTC

allura git commit: Exports to use attachment base name (in case import or email reply, etc created one with dir paths)

Repository: allura
Updated Branches:
  refs/heads/master 6a20132bc -> c55705c60


Exports to use attachment base name (in case import or email reply, etc created one with dir paths)


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c55705c6
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c55705c6
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c55705c6

Branch: refs/heads/master
Commit: c55705c60d98228bbc30840c0ca16a654f8808db
Parents: 6a20132
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Apr 4 15:20:28 2016 -0400
Committer: Heith Seewald <he...@gmail.com>
Committed: Wed Apr 6 14:17:26 2016 -0400

----------------------------------------------------------------------
 Allura/allura/app.py                      | 2 +-
 Allura/allura/model/discuss.py            | 2 +-
 ForgeTracker/forgetracker/model/ticket.py | 2 +-
 ForgeWiki/forgewiki/model/wiki.py         | 2 +-
 ForgeWiki/forgewiki/tests/test_app.py     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c55705c6/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 1e803a8..db3cb8d 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -771,7 +771,7 @@ class Application(object):
         for attachment in attachments:
             attachment_path = os.path.join(
                 path,
-                attachment.filename
+                os.path.basename(attachment.filename)
             )
             with open(attachment_path, 'w') as fl:
                 fl.write(attachment.rfile().read())

http://git-wip-us.apache.org/repos/asf/allura/blob/c55705c6/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index dff6509..82e1da1 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -182,7 +182,7 @@ class Thread(Artifact, ActivityObject):
                          str(self.artifact._id),
                          self._id,
                          page.slug,
-                         attach.filename)
+                         os.path.basename(attach.filename))
                      ) for attach in page.attachments]
 
     def attachemtns_for_json(self, page):

http://git-wip-us.apache.org/repos/asf/allura/blob/c55705c6/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index b417604..c21a7d8 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -1112,7 +1112,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
                      path=os.path.join(
                          self.app_config.options.mount_point,
                          str(self._id),
-                         attach.filename)) for attach in self.attachments]
+                         os.path.basename(attach.filename))) for attach in self.attachments]
 
     def attachments_for_json(self):
         return [dict(bytes=attach.length,

http://git-wip-us.apache.org/repos/asf/allura/blob/c55705c6/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index f045802..4c79045 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -130,7 +130,7 @@ class Page(VersionedArtifact, ActivityObject):
                      path=os.path.join(
                          self.app_config.options.mount_point,
                          str(self._id),
-                         attach.filename)) for attach in self.attachments]
+                         os.path.basename(attach.filename))) for attach in self.attachments]
 
     def attachments_for_json(self):
         return [dict(bytes=attach.length,

http://git-wip-us.apache.org/repos/asf/allura/blob/c55705c6/ForgeWiki/forgewiki/tests/test_app.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/test_app.py b/ForgeWiki/forgewiki/tests/test_app.py
index 5ffb690..98d6d5f 100644
--- a/ForgeWiki/forgewiki/tests/test_app.py
+++ b/ForgeWiki/forgewiki/tests/test_app.py
@@ -93,7 +93,7 @@ class TestBulkExport(object):
         self.page.text = 'test_text'
         self.page.mod_date = datetime.datetime(2013, 7, 5)
         self.page.labels = ['test_label1', 'test_label2']
-        self.page.attach('test_file', StringIO('test string'))
+        self.page.attach('some/path/test_file', StringIO('test string'))
         ThreadLocalORMSession.flush_all()
 
     def test_bulk_export_with_attachmetns(self):