Advertisement:

View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004825SMF 2.0[SMF 2.1] Attachmentspublic2011-09-08 10:212012-02-18 17:21
ReporterThantos 
PrioritynormalSeveritymajorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
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 Filespatch file icon attachment.php_2.patch [^] (309 bytes) 2011-09-08 11:11 [Show Content]
patch file icon attachment.php_3.patch [^] (329 bytes) 2011-11-27 02:37 [Show Content]

- Relationships

-  Notes
(0014165)
Thantos (SMF Friend)
2011-09-08 11:12

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.
(0014166)
Illori (Team Member)
2011-09-08 11:14

first patch removed.
(0014167)
Illori (Team Member)
2011-09-11 07:58

closing as user reported this as not a bug due to browser settings.
(0014169)
Thantos (SMF Friend)
2011-09-11 10:13
edited on: 2011-09-11 10:15

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

(0014262)
Thantos (SMF Friend)
2011-11-27 02:37

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.
(0014274)
feline (Beta Tester)
2011-12-11 11:53

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

I am inclined to use feline's patch because it encodes all characters. Any tests I should be on the lookout for?
(0014276)
feline (Beta Tester)
2011-12-13 08:16

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));
(0014279)
groundup (SMF Friend)
2011-12-13 22:53

I committed these fixes in trunk. Please test.
(0014289)
Illori (Team Member)
2011-12-24 09:15

this issue has been fixed in firefox 9.0.1 without needing the patch above.
(0014292)
feline (Beta Tester)
2011-12-26 13:32

Both patches they I have posted above works with FF8 and FF9.0.1 !!!
(0014297)
groundup (SMF Friend)
2011-12-27 13:59

I feel that we should always output the content-length anyway.
(0014420)
Spuds (SMF Friend)
2012-02-18 17:21

Commit:3c431b6cf90c6a3fe77f37f7957c0a9d5d7f5865

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