Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1]: Wrong Content-Disposition header being set for attachments served to mobile browsers #8098

Closed
Sesquipedalian opened this issue Feb 12, 2024 · 0 comments
Milestone

Comments

@Sesquipedalian
Copy link
Member

Basic Information

Attachments are being served to mobile browsers with a "Content-Disposition: inline" header when they should be served with a "Content-Disposition: attachment" header.

https://www.simplemachines.org/community/index.php?msg=4169626

Steps to reproduce

  1. Attach an XML file to a post.
  2. Attempt to download the attachment using a mobile browser.

Expected result

The XML file is saved as a file.

Actual result

The XML file is opened in a browser window.

Version/Git revision

2.1.4

Database Engine

All

Database Version

No response

PHP Version

No response

Logs

No response

Additional Information

The problem appears to be the !== comparison operators on this line:

if (isset($_REQUEST['image']) || (isBrowser('is_mobile') && (strpos($file['mime_type'], 'audio/') !== 0 || strpos($file['mime_type'], 'video/') !== 0)))

They should actually be === operators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant