Hi,

On 11 Mai, 15:03, Marty Alchin <gulop...@gmail.com> wrote:
> If you're using the filename to store it somewhere else, typically for
> denormalization, it'd be better to do that post-save, since then you
> know the record actually got saved in the database. Otherwise, you
> might be trying to access the content of the file, which would be
> better using the direct file access, which can often save yourself a
> round-trip to the storage backend (which can be a big win for paid
> storage solutions, like S3).
I was reading about #8593 today and I think this adds a new layer of
complexity to the problem.  Some operating systems perform filename
normalization on their own.  While the case covered in the bug only
affects Windows machines and is a weird behavior in the Python ntpath
module instead of the Kernel, it could cause some troubles.

On an OS X machine the operating system will normalize the filename to
some sort of unicode normalization form.  (The exact one depends on
the version of OS X you're running).  This translation happens in a
way that you will not notice it from inside your application. The
normalization however happens in the IO system and not the HSF file
system.  Now imagine you're writing to an NFS share that is also
accessed from linux.  If they two would use the same database as well,
the Linux version would not be able to locate the file on the
filesystem because the entry in the database would be only valid if
the OS does the normalization again when opening the file.

This sounds unrelated to the bug we're discussing here, but it raises
the problem that the value that ends up in the database is probably
not exactly the value the real name of the file. Maybe there should be
a setting in django to switch the filename generation for the uploaded
files to something pre-normalized inside django to make the filename
more reliable. (Maybe go as far as lowercase and ASCII only?).  Either
way it shows that the filename on the file system is unreliable for
pretty much everything except loading and replacing the file. On file
creation the code can already "rename" the file to avoid clashes.

Regards,
Armin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to