The url() method strips trailing slash from the given name
alisspers opened this issue · comments
We're using the plugin django-ckeditor to add a wysiwyg editor to our models. The package fails to load its static files when used together with django-s3-storage, because of a lost slash when constructing the URL that ends up looking something like this:
https://[my-bucket].s3.eu-central-1.amazonaws.com/ckeditor/ckeditorconfig.js?
while it's supposed to look like this:
https://[my-bucket].s3.eu-central-1.amazonaws.com/ckeditor/ckeditor/config.js?
(notice the missing slash before config.js)
This happens because django-ckeditor calls url()
with the name 'ckeditor/ckeditor/'
, and somewhere along the way this trailing slash is removed.
I've drilled it down to being the _get_key_name
that strips the trailing slash.
django-s3-storage/django_s3_storage/storage.py
Lines 205 to 208 in 2748957
It's using posix.normpath which by design strips trailing slashes.
A proposed solution would be to readd the trailing slash after running normpath (much like the PR in the "sister package" django-storage)