matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.27k stars 275 forks source link

Fix equality checking of paths by normalizing them #550

Closed armanexplorer closed 1 year ago

armanexplorer commented 2 years ago

The main reason for this PR is the final part of the FileSystemStorage._save() method in the Django library that leads to generating unnormalized paths:

...

# Store filenames with forward slashes, even on Windows.
return str(name).replace('\\', '/')

So, we should care for the normalized paths generated by namer (using os.path.normpath()) against the unnormalized paths generated by Django Storage. Hence, this leads to a fault when the OS doesn't use forward slashes for the path formatting, like Windows.

Tekpakma commented 1 year ago

Good change IMO, fixes annoying logger message on Windows.

vstoykov commented 1 year ago

Thanks for the contribution