diff --git a/anki/media.py b/anki/media.py index 822982050..716da58ff 100644 --- a/anki/media.py +++ b/anki/media.py @@ -342,7 +342,7 @@ class MediaManager(object): def hasIllegal(self, str): # a file that couldn't be decoded to unicode is considered invalid if not isinstance(str, unicode): - return False + return True return not not re.search(self._illegalCharReg, str) # Media syncing - bundling zip files to send to server diff --git a/tests/test_media.py b/tests/test_media.py index 4eb673768..e47ac8454 100644 --- a/tests/test_media.py +++ b/tests/test_media.py @@ -1,8 +1,12 @@ # coding: utf-8 -import tempfile, os, time +import tempfile +import os +import time + from shared import getEmptyDeck, testDir + # copying files to media folder def test_add(): d = getEmptyDeck() @@ -100,8 +104,8 @@ def test_changes(): def test_illegal(): d = getEmptyDeck() - aString = "a:b|cd\\e/f\0g*h" - good = "abcdefgh" + aString = u"a:b|cd\\e/f\0g*h" + good = u"abcdefgh" assert d.media.stripIllegal(aString) == good for c in aString: bad = d.media.hasIllegal("somestring"+c+"morestring")