mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 17:56:30 +00:00
Fixed slugify
This commit is contained in:
@@ -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))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user