Fix weird filename edgecase with some ifs file.
This commit is contained in:
parent
c4a5abaf4d
commit
495466f4e4
@ -196,6 +196,11 @@ class IFS:
|
||||
name = subchild.attribute('name')
|
||||
if name is None:
|
||||
raise Exception(f"Texture entry {subchild} has no name!")
|
||||
if ' ' in name:
|
||||
# Certain files that were corrupted on create or copy
|
||||
# seem to have spaces in the name which shouldn't be
|
||||
# allowed. Lob them off.
|
||||
name = name[:name.find(' ')]
|
||||
md5sum = hashlib.md5(name.encode(encoding)).hexdigest()
|
||||
oldname = os.path.join(texdir, md5sum)
|
||||
newname = os.path.join(texdir, name)
|
||||
|
@ -422,7 +422,7 @@ class BinaryDecoder:
|
||||
# Need to convert this from encoding to standard string.
|
||||
# Also, need to lob off the trailing null.
|
||||
try:
|
||||
val = val[:-1].decode(self.encoding)
|
||||
val = val[:-1].decode(self.encoding, 'replace')
|
||||
except UnicodeDecodeError:
|
||||
# Nothing we can do here
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user