filebrowser-safe icon indicating copy to clipboard operation
filebrowser-safe copied to clipboard

Uploaded files with ampersand in name can't be deleted or renamed

Open mitnosirrag opened this issue 9 years ago • 0 comments

Uploaded files with an ampersand (&) in their name fail to rename or delete.

To recreate for deletion:

  1. Upload an image with an ampersand (&) in the title
  2. Try to delete the image
  3. The image is reported as having been deleted, but remains in the system

To recreate for renaming (file is called "pantry_&_kitchen.jpeg"):

  1. Upload an image with an ampersand (&) in the title
  2. Click the icon to rename the image
  3. Apply a new name and slick "submit"
  4. The following error appears:

IOError at /admin/media-library/rename/ [Errno 2] No such file or directory: u'/home/ubuntu/media/uploads/products/pantry_'

I fixed the deletion issue locally, it appears that tagging file.filename with |urlencode does the trick. I applied it to lines 89 and 101 in templates/filebrowser/include/filelisting.html and am able to delete images.

I haven't figured out how the query_string tag works to fix the encoding there, but it seems like the fix would need to be applied there and maybe in templates/filebrowser/rename.html.

mitnosirrag avatar Sep 29 '16 18:09 mitnosirrag