Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
asset library system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Jun 2010 at 17:27 UTC
Updated:
20 Jan 2016 at 10:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mikeytown2 commentedComment #2
c960657 commentedWouldn't it be better to add proper error handling to file_unmanaged_save_data(), i.e. if it fails to save the file, it should remove the empty file and return FALSE?
Comment #3
mikeytown2 commentedhttp://api.drupal.org/api/function/file_unmanaged_save_data/7
Here's a patch for checking filesize in file_unmanaged_save_data.
Comment #5
mikeytown2 commentedComment #6
mikeytown2 commentedpatch for 6.x
Comment #7
c960657 commentedIf writing the file fails, file_unmanaged_move() is supposed to return FALSE. Shouldn't you just check for that?
Comment #8
mikeytown2 commentedgood point
Comment #9
mikeytown2 commentedComment #10
thedavidmeister commentedSo, this still seems to be in the same state in 8.x
Patch no longer applies.
The patch in #9 doesn't just affect serving JS/CSS files, it is a blanket modification to file_unmanaged_save_data(). It's unclear from the issue summary and subsequent comments whether the intention is to do this or just handle JS/CSS - if the former, we should be checking the size of $data before doing anything else and bail early if appropriate.
This patch needs tests.
The referenced issue #818818: Race Condition when using file_save_data FILE_EXISTS_REPLACE is closed as a duplicate #1377740: file_unmanaged_move() should issue rename() where possible instead of copy() & unlink(), which doesn't seem to be handling zero size files.
Review bonus #2094585: [policy, no patch] Core review bonus for #1898420: image.module - Convert theme_ functions to Twig.
Comment #11
dawehner.
Comment #12
wim leersPer #755586-46: Fallback for CSS/JS aggregation for non-writable directories, moving back to Drupal 7.