Skip to content

Commit

Permalink
Fix bug with ':' in paths in batch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Larralde committed Dec 10, 2017
1 parent 4605f76 commit 3106893
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion instaLooter/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ def getTargets(self, raw_string):
if raw_string is not None:
for line in raw_string.splitlines():
if line:
target, directory = line.split(':')
target, directory = line.split(':', 1)
targets[target.strip()] = directory.strip()
return targets
24 changes: 23 additions & 1 deletion tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import six
import operator
import unittest
import textwrap
import tempfile
import shutil
import glob
Expand All @@ -15,7 +16,7 @@
import PIL.Image

import instaLooter

import instaLooter.batch


class TestResolvedIssues(unittest.TestCase):
Expand Down Expand Up @@ -308,6 +309,27 @@ def test_issue_94(self):
os.path.join(self.tmpdir, 'BY77tSfBnRm.jpg'), True)
self.assertTrue(metadata['Exif']['UserComment'])

def test_issue_125(self):
"""
Thanks to @applepanda for reporting this bug.
Make sure colons in path do not cause issue in batch mode.
"""
configfile = six.StringIO(textwrap.dedent(
"""
[Family]
users =
instagram: D:\\Instagram\\Profiles\\instagram
therock: D:\\Instagram\\Profiles\\therock
"""
))
runner = instaLooter.batch.BatchRunner(configfile)
self.assertEqual(
runner.getTargets(runner._get('Family', 'users')),
{'instagram': 'D:\\Instagram\\Profiles\\instagram',
'therock': 'D:\\Instagram\\Profiles\\therock'}
)



class TestPullRequests(unittest.TestCase):
Expand Down

0 comments on commit 3106893

Please sign in to comment.