incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [2/3] git commit: [#6922] ticket:501 Fixed freeze when importing issue tracker
Date Fri, 13 Dec 2013 17:28:16 GMT
[#6922] ticket:501 Fixed freeze when importing issue tracker

  Chenged regexp to match image URL


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

Branch: refs/heads/master
Commit: 42e29a316cc958d372ee587e74684cea8b7162eb
Parents: b988a93
Author: Andriy Sherepa <asherepa@gmail.com>
Authored: Wed Dec 11 10:39:08 2013 +0200
Committer: Cory Johns <admin1@users.sf.net>
Committed: Thu Dec 12 20:48:09 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/github/tracker.py            | 2 +-
 ForgeImporters/forgeimporters/tests/github/test_tracker.py | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/42e29a31/ForgeImporters/forgeimporters/github/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tracker.py b/ForgeImporters/forgeimporters/github/tracker.py
index cda1466..97ea16b 100644
--- a/ForgeImporters/forgeimporters/github/tracker.py
+++ b/ForgeImporters/forgeimporters/github/tracker.py
@@ -245,7 +245,7 @@ class GitHubTrackerImporter(ToolImporter):
         # usual syntax is
         # ![cdbpzjc5ex4](https://f.cloud.github.com/assets/979771/1027411/a393ab5e-0e70-11e3-8a38-b93a3df904cf.jpg)\r\n
         REGEXP = r'!\[[\w0-9]+?\]\(((?:https?:\/\/)?[\da-z\.-]+\.[a-z\.]{2,6}'\
-            '(?:[\/\w\.-]+)*.(jpg|jpeg|png|gif))\)\r\n'
+            '(?:[\/%\w\.-]+)*.(jpg|jpeg|png|gif))\)(\r\n){0,1}'
         attachments = []
 
         try:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/42e29a31/ForgeImporters/forgeimporters/tests/github/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/github/test_tracker.py b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
index e3da3c7..9679c6b 100644
--- a/ForgeImporters/forgeimporters/tests/github/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
@@ -117,11 +117,13 @@ class TestTrackerImporter(TestCase):
     def test_get_attachments(self):
         importer = tracker.GitHubTrackerImporter()
         body = 'hello\n' \
-        '![cdbpzjc5ex4](https://f.cloud.github.com/assets/979771/1027411/a393ab5e-0e70-11e3-8a38-b93a3df904cf.jpg)\r\n'
+        '![cdbpzjc5ex4](https://f.cloud.github.com/assets/979771/1027411/a393ab5e-0e70-11e3-8a38-b93a3df904cf.jpg)\r\n'
\
+        '![screensh0t](http://f.cl.ly/items/13453x43053r2G0d3x0v/Screen%20Shot%202012-04-28%20at%2010.48.17%20AM.png)'
         new_body, attachments = importer._get_attachments(body)
         self.assertEqual(new_body, 'hello\n')
-        self.assertEqual(len(attachments), 1)
+        self.assertEqual(len(attachments), 2)
         self.assertEqual(attachments[0].url, 'https://f.cloud.github.com/assets/979771/1027411/a393ab5e-0e70-11e3-8a38-b93a3df904cf.jpg')
+        self.assertEqual(attachments[1].url, 'http://f.cl.ly/items/13453x43053r2G0d3x0v/Screen%20Shot%202012-04-28%20at%2010.48.17%20AM.png')
 
     def test_process_comments(self):
         ticket = mock.Mock()


Mime
View raw message