-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Image filename/title is not dynamic when using Next/Image and external URLs #26737
Comments
hi @JarrodMFlesch! The difference is that the images do have the So, I guess it should be sent in the response by the Next server then, when handling requests in the @timneutkens @styfle wdyt? |
Yes, looks like we're missing the Would you like to create a PR with a test to fix it? 🙂 |
Hi @styfle! Sure, I'll do that when I get my mac back from repairing :D |
In this PR I've added the `Content-Disposition` header to the response of the image `/_next/image` route. That header is used by the browser when showing the dialog for the `Save image as...` action. There are some differences between the browsers, ex: When requesting the image `test.jpg`, the response header `Content-Type: image/webp` - in FF the filename from the `Save image as...` dialog would be `test.webp` but in Chrome `test.jpg` even if the `Content-Disposition: inline; filename="test.webp"` is present in the headers. The same about png images, the rest types are fine. It looks like FF is checking the `Content-Type` for the extension but the Chrome does not and is doing another type of check. Fixes #26737 ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes
In this PR I've added the `Content-Disposition` header to the response of the image `/_next/image` route. That header is used by the browser when showing the dialog for the `Save image as...` action. There are some differences between the browsers, ex: When requesting the image `test.jpg`, the response header `Content-Type: image/webp` - in FF the filename from the `Save image as...` dialog would be `test.webp` but in Chrome `test.jpg` even if the `Content-Disposition: inline; filename="test.webp"` is present in the headers. The same about png images, the rest types are fine. It looks like FF is checking the `Content-Type` for the extension but the Chrome does not and is doing another type of check. Fixes vercel#26737 ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
10.2.0
What version of Node.js are you using?
14.15.5
What browser are you using?
Chrome/Brave
What operating system are you using?
macOS
How are you deploying your application?
Vercel, next start
Describe the Bug
When attempting to right-click download an image using Next/Image that is hosted outside of the static folder (i.e. a CMS), the title of the image is set to
image
for all images.Expected Behavior
Images should right-click download with the name of the image, like locally hosted static images do.
To Reproduce
image
The text was updated successfully, but these errors were encountered: