Import: Remove unicode translation from addImportFile
A filename is an almost arbitrary binary sequence, assuming it can be encoded in utf-8 caused crashes on certain file names.
This commit is contained in:
parent
0cef119a3b
commit
59d22bed5d
|
@ -170,7 +170,7 @@ class Importer:
|
||||||
def addImportFile(self, filename, site = "default", filter = "passthrough"):
|
def addImportFile(self, filename, site = "default", filter = "passthrough"):
|
||||||
#TODO: test it is a valid file -> put that in config!!
|
#TODO: test it is a valid file -> put that in config!!
|
||||||
#print "addimportfile: filename is a", filename.__class__
|
#print "addimportfile: filename is a", filename.__class__
|
||||||
# filename now comes in as unicode
|
# filename not guaranteed to be unicode
|
||||||
if filename in self.filelist or not os.path.exists(filename):
|
if filename in self.filelist or not os.path.exists(filename):
|
||||||
return
|
return
|
||||||
self.filelist[filename] = [site] + [filter]
|
self.filelist[filename] = [site] + [filter]
|
||||||
|
@ -196,11 +196,10 @@ class Importer:
|
||||||
if os.path.isdir(inputPath):
|
if os.path.isdir(inputPath):
|
||||||
for subdir in os.walk(inputPath):
|
for subdir in os.walk(inputPath):
|
||||||
for file in subdir[2]:
|
for file in subdir[2]:
|
||||||
self.addImportFile(unicode(os.path.join(subdir[0], file),'utf-8'),
|
self.addImportFile(os.path.join(subdir[0], file), site=site, filter=filter)
|
||||||
site=site, filter=filter)
|
|
||||||
else:
|
else:
|
||||||
|
self.addImportFile(inputPath, site=site, filter=filter)
|
||||||
|
|
||||||
self.addImportFile(unicode(inputPath,'utf-8'), site=site, filter=filter)
|
|
||||||
#Add a directory of files to filelist
|
#Add a directory of files to filelist
|
||||||
#Only one import directory per site supported.
|
#Only one import directory per site supported.
|
||||||
#dirlist is a hash of lists:
|
#dirlist is a hash of lists:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user