collectiveaccess / pawtucket2

Pawtucket Improved
GNU General Public License v3.0
82 stars 75 forks source link

Filename Corruption Upon Download #34

Closed miqrogroove closed 2 years ago

miqrogroove commented 2 years ago

Steps to reproduce bug:

Expected result:

Actual result:

Workaround:

It would be necessary to change the filename prior to upload. I had attempted to add the Original filename field to the Object representation editor; it displays the name but will not save any changes.

collectiveaccess commented 2 years ago

original filename is read-only and derived from the as-uploaded name.

If the file name doesn't include spaces and ampersands, it works?

miqrogroove commented 2 years ago

If the file name doesn't include spaces and ampersands, it works?

Spaces are being replaced by underscore _ which I would consider reasonable. I haven't tested any other chars, but I do have many files with & in the name.

And yes, it works without ampersands.

collectiveaccess commented 2 years ago

Got it thanks. We will resolve.

miqrogroove commented 2 years ago

Workaround 2: Edit the downloaded_file_naming preference in themes/default/conf/app.conf

Workaround 3: at https://github.com/collectiveaccess/pawtucket2/blob/84dbafa54fa2b7724931ab5d992fc9a7a248a01e/themes/default/views/Details/object_representation_download_binary.php#L37 ... Change the whole line as follows ...

$dname = htmlspecialchars_decode($this->getVar('version_download_name'), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401);
$dname = str_replace('"', '_', $dname);
header("Content-Disposition: attachment; filename=\"$dname\"");
collectiveaccess commented 2 years ago

Pushed changes to resolve this to master.