On a clean install upload.module enabled:
- Create a new story
- Attach a file
- Save the story
- Edit the story
- Check the delete checkbox
- Save the node

The file is removed from the node, but it remains in the file table (with a status of '1') and on disk.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drewish’s picture

Status: Active » Needs review
FileSize
937 bytes

yup, looks like we're missing a call to file_delete().

webernet’s picture

Status: Needs review » Needs work

This deletes the files, but leaves the entries in the files table.

drewish’s picture

FileSize
1.21 KB

right you are. this also checks that the file isn't used in a different revision.

drewish’s picture

Status: Needs work » Needs review
FileSize
1.43 KB

webernet pointed out that {file} should be {files}, also now using $fid consistently.

drewish’s picture

FileSize
1.43 KB

forgot to remove my debugging code.

drewish’s picture

FileSize
1.17 KB

this is the right patch... for real... i swear.

webernet’s picture

Status: Needs review » Reviewed & tested by the community

Works fine.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Any other node could now use the same file, or not? This is not only about revisions, right? Let's get the comment right!

drewish’s picture

Status: Needs work » Reviewed & tested by the community

that comment is correct. it only needs to worry about the file being attached to other versions of the same node.

Gábor Hojtsy’s picture

why?

drewish’s picture

because that's the way the module works... attach a file to a node and it generates a new fid which is shared between multiple revisions of a node. files aren't shared between nodes, dopry and i had worked on allowing that type of thing but it didn't make it in before the freeze.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Ah, all right, seems like I don't have an actual picture on the upload module. This patch committed then, thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)