Media browser plus attempts to move files into the created media root directory when it is enabled, but it does this by creating a new path using the file_managed "filename" value. This value is not guaranteed to be unique, so this method causes duplicate file URIs to be created; as this is enforced as unique with a DB constraint, enabling the module fails and the filesystem and file_managed table are both left in an inconsistent state.
Flagged as major due to the potential damage to file_managed data and to the files themselves.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | media_browser_plus-filename_handling-1564678-4.patch | 586 bytes | jhnbrnn |
| #2 | media_browser_plus-filename_handling-1564678-2.patch | 545 bytes | jhnbrnn |
Comments
Comment #1
elyobo commentedSimply calling file_move() with the destination directory, rather than directory + a file name, avoids the problem.
Comment #2
jhnbrnn commentedHere's a one-line fix as per #1's recommendation.
Comment #3
camdarley commentedIf you remove this line, $destination is not declared anymore...
If think it should be better like this:
Isn't it?
Comment #4
jhnbrnn commentedAh, you're totally right. Re-rolled with changes.
Comment #5
das-peter commentedSounds sane :)
Comitted: http://drupalcode.org/project/media_browser_plus.git/commit/938e74a