Browser issue Attachments loose their name if downloaded.

Affected version
2.1.x

Alfa1

Well-known member
I'm not sure if this is a bug or not. The issue has been bugging me for years though. When you download an attachment from XF by dragging it to your desktop then it looses its name and is always '.jpg'. So 'whatever.jpg' becomes '.jpg'

So if you download multiple attachments then they overwrite because those are all named '.jpg'. So I keep renaming those.
If you see an oppertunity to tweak this behavior then that would be nice.
 

Martok

Well-known member
I've just tried dragging and dropping the attachments from this thread:

https://xenforo.com/community/threads/testing-attachment.149671/

and I don't get the issue of it being called just '.jpg'. However, the attachment isn't called 'cl.jpg' as it was (presumably) when it was uploaded, it is '179054-39d426b380c2e008ab0b98ddc142621b.jpg" when I download it. It's only if you click on the attachment and from the page that opens https://xenforo.com/community/attachments/cl-jpg.179057/ do you get the correct name, 'cl.jpg' if you drag and drop on the desktop.

Do you get the same as I do on this site, or do you just get it named '.jpg'? If you do have an issue, what OS and browser are you using? Does the same happen with a different browser and a different computer?
 

Martok

Well-known member
This is a report for xf 1.5.22
Yes, the report is for XenForo 1.5.22. However, you said that the issue has been bugging you for years, implying that the issue applied to previous versions and, from your last sentence, I assumed you were saying it still happened in the latest 2.x software.

I have tried this in XenForo 1.5.21, 1.5.22 and the 2.x version on this site. I didn't get files called just '.jpg' and my previous post explains what I did get.

So my questions to you still stand in order to try and troubleshoot this issue.
 

Mike

XenForo developer
Staff member
This appears to be browser specific. It happens in Firefox but not Chrome. Chrome gives the correct filename.

If it's what I expect, this is a browser issue. We send a header indicating the correct filename (when viewing the full attachment) -- you can see this if you right click to save the image. Firefox doesn't appear to use this as expected when dragging.

I will leave this open for now, potentially to create a reduced test case as a bug report to Mozilla, but it's very unlikely that we can do much to workaround this.
 

Martok

Well-known member
I've tested this with Firefox Quantum 62.0 (64-bit) on Max OS 10.13.6 and XenForo 1.5.22 with no issues. I wonder if it is dependent on the OS used?
 

Chris D

XenForo developer
Staff member
This issue still exists in XF 2.1 and with a bit more testing, I concur with @Mike that it seems to be related to Firefox mishandling the Content-Disposition header here. When displaying the image inline, Chrome and other browsers appear to apply that header, whereas on Windows and macOS it is omitted entirely. It may be stripped intentionally for some reason, but it is that which provides the filename. It's inconsistent too, of course, because right click > save as will read the filename from this header.

It's ultimately a browser issue, but we will provide a reduced test case to Firefox when we're next working on 2.1 bug reports.
 
Top