#9586: Shall upload_to return an urlencoded string or not?
----------------------------------+-----------------------------------------
Reporter: eibaan | Owner: nobody
Status: new | Milestone:
Component: File uploads/storage | Version: 1.0
Keywords: | Stage: Unreviewed
Has_patch: 0 |
----------------------------------+-----------------------------------------
Assume a custom upload_to function. If I return any unicode string (for
example "{{{Großköln / €}}}"), that string is tried to use as a filename
and as the URL. It might be an invalid file name and/or an invalid URL. If
I use django.util.http.urlquote before returning the string, it becomes a
valid URL but at the same time, the file is saved as
"{{{Gro%C3%9Fk%C3%B6ln%20/%20%E2%82%AC}}}" but is tried to load as
"{{{Großköln / €}}}" (because the browser already decodes it) from the
file system. This does not work. I think, the URL (at least the one used
in the admin UI) needs to be urlencoded once more. Or the default storage
should automatically make sure that it can store files under any name and
is not restricted to the restrictions of the file system.
I'm not sure what's the best solution but right now, it doesn't work for
anything but an unspecified safe subset of characters. And because there's
one function that is the base for both the file system name and the URL
path segment, I cannot easiliy fix it.
--
Ticket URL: <http://code.djangoproject.com/ticket/9586>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---