Hello,

I'm really new to drupal (great software!) but I had to trace down a bug on a site made by my developers.

It's not a drupal bug but a small conception problem that you might not want to change.

In the tables "files" drupal keeps the filesize of the uploaded file (when you use drupal itself), although obviously this filesize will only be changed if the user constantly use drupal to manage his files. If for some reason (like for example using CVS/subversion as do developers constantly) someone changes the file on disk, the filesize will be wrong.

This problem is very minor as it is but starts to be painful when you activate the "private file system" (drupal manages the download of the files to check your rights before doing so). Once this is activated, drupal will generate the HTTP header to send the file and will report a wrong filesize, resulting :
- under IE, if fake filesize is lower than the real --> breaks
- under IE, if fake filesize is greater than the real --> wait for timeout before display image
- under FF, if fake filesize is lower than real --> works ok for image, didnt check others
- under FF, if fake filesize is greater than the real --> display quickly the image but still wait for timeout

Unless there is a good reason I dont know about yet for drupal, it's usually a good thing to do not save too many information related to a file that you can find directly on the filesystem (getting the size is quick and easy on-the-fly) and avoiding the common "caching problem" (a value which is not real because not realtime).

I would understand if it is not modified in future version but this could help some other developers out there.

Regards

Comments

gpk’s picture

Status: Needs review » Active

Changing status ("needs review" means there is a patch attached which fixes the problem..!!)

>If for some reason someone changes the file on disk
Yes, don't do it!!

If you want to manage certain files yourself, then put them somewhere else!! e.g. sites/default/myfiles...

Probably it should be documented somewhere (if it isn't already) that modifying stuff in your sites/default/files folder is a very bad idea!

Also it would probably be possible to write a custom module (if there isn't one already) that checks all the files and updates the database accordingly, or alternatively ignores the info in the database and queries the file dynamically.

>understand if it is not modified in future version
Yes, this is probably "won't fix" or "by design".

bladedu’s picture

Status: Active » Closed (won't fix)

As explained in comment 1, this works by design and thus there's nothing to be fixed.