1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 09:46:25 +00:00

Fixed slugify

This commit is contained in:
Paweł Jastrzębski
2013-09-30 18:32:43 +02:00
parent 111bfb9302
commit d07d49d2e7

View File

@@ -599,7 +599,8 @@ def sanitizeTree(filetree):
else: else:
splitname = os.path.splitext(name) splitname = os.path.splitext(name)
slugified = slugify(splitname[0]) slugified = slugify(splitname[0])
while os.path.exists(os.path.join(root, slugified + splitname[1])): while os.path.exists(os.path.join(root, slugified + splitname[1])) and splitname[0].upper()\
!= slugified.upper():
slugified += "A" slugified += "A"
os.rename(os.path.join(root, name), os.path.join(root, slugified + splitname[1])) os.rename(os.path.join(root, name), os.path.join(root, slugified + splitname[1]))
for name in dirs: for name in dirs:
@@ -607,7 +608,7 @@ def sanitizeTree(filetree):
os.remove(os.path.join(root, name)) os.remove(os.path.join(root, name))
else: else:
slugified = slugify(name) slugified = slugify(name)
while os.path.exists(os.path.join(root, slugified)): while os.path.exists(os.path.join(root, slugified)) and name.upper() != slugified.upper():
slugified += "A" slugified += "A"
os.rename(os.path.join(root, name), os.path.join(root, slugified)) os.rename(os.path.join(root, name), os.path.join(root, slugified))