Advertisement:
Anonymous Login
12-05-2016 07:48 PM

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004825SMF 2.0[SMF 2.1] Attachmentspublic2012-02-18 17:21
ReporterThantos 
PrioritynormalSeveritymajorReproducibilityhave not tried
StatusresolvedResolutionfixed 
Summary0004825: Firefox attachment Content-Disposition bug
Descriptionhttp://www.simplemachines.org/community/index.php?topic=451766.0

There is a bug in the Content-Disposition we send to Firefox for attachment download.

We are sending Content-Disposition: attachment; filename*="UTF-8''FILENAME" but the trailing double quote should not be there.
Additional InformationApply attached patch to /Sources/Attachment.php to fix the issue.
Tags2.1
Attached Files
  • patch file icon attachment.php_2.patch (309 bytes) 2011-09-08 11:11 -
    165c165
    < 		header('Content-Disposition: ' . $disposition . '; filename*="UTF-8\'\'' . preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name) . '"');
    ---
    > 		header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name));
    
    patch file icon attachment.php_2.patch (309 bytes) 2011-09-08 11:11 +
  • patch file icon attachment.php_3.patch (329 bytes) 2011-11-27 02:37 -
    165c165
    < 		header('Content-Disposition: ' . $disposition . '; filename*="UTF-8\'\'' . preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name) . '"');
    ---
    > 		header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . str_replace(' ', '%20', preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name)));
    patch file icon attachment.php_3.patch (329 bytes) 2011-11-27 02:37 +

-Relationships
+Relationships

-Notes

bugnote:0014165

Thantos (SMF Friend)

Please see second patch file. First one failed to remove the double quote in front of the UTF8 string.

Can't seem to delete the first patch file.

bugnote:0014166

Illori (Team Member)

first patch removed.

bugnote:0014167

Illori (Team Member)

closing as user reported this as not a bug due to browser settings.

bugnote:0014169

Thantos (SMF Friend)

Last edited: 2011-09-11 10:15

View 2 revisions

The Opera issue was a user setting, not the Firefox issue.

bugnote:0014262

Thantos (SMF Friend)

The above patch doesn't handle spaces in the file names properly. The new patch is on the mod site and appears to be working.

bugnote:0014274

feline (Viewer)

Better ...
    if ($context['browser']['is_firefox'])
        header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name)));

bugnote:0014275

groundup (SMF Friend)

I am inclined to use feline's patch because it encodes all characters. Any tests I should be on the lookout for?

bugnote:0014276

feline (Viewer)

A second (minor Bug) with FF8 .. the file size is shown as 1 byte.
To fix this replace
    if (empty($modSettings['enableCompressedOutput']) || filesize($filename) > 4194304)
        header('Content-Length: ' . filesize($filename));

with:
    header('Content-Length: ' . filesize($filename));

bugnote:0014279

groundup (SMF Friend)

I committed these fixes in trunk. Please test.

bugnote:0014289

Illori (Team Member)

this issue has been fixed in firefox 9.0.1 without needing the patch above.

bugnote:0014292

feline (Viewer)

Both patches they I have posted above works with FF8 and FF9.0.1 !!!

bugnote:0014297

groundup (SMF Friend)

I feel that we should always output the content-length anyway.

bugnote:0014420

Spuds (Viewer)

Commit:3c431b6cf90c6a3fe77f37f7957c0a9d5d7f5865

! Update for Firefox headers
+Notes
MantisBT (Modified for SMF Intergration)[^] Copyright © 2000 - 2010 Mantis Group