Skip to content
New issue

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

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

Already on GitHub? # to your account

Invalid content type and filename returned when resizing the image. #8558

Open
ianwallen opened this issue Dec 12, 2024 · 0 comments
Open

Invalid content type and filename returned when resizing the image. #8558

ianwallen opened this issue Dec 12, 2024 · 0 comments
Labels
Milestone

Comments

@ianwallen
Copy link
Contributor

Describe the bug
Downloading an image using the following url
https://www.geocat.ch/geonetwork/srv/api/records/b0b45bd3-e556-4641-97e3-641c94ec6567/attachments/2009.jpg?size=320

Will produce the incorrect content type and incorrect filename.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://www.geocat.ch/geonetwork/srv/api/records/b0b45bd3-e556-4641-97e3-641c94ec6567/attachments/2009.jpg?size=320
  2. Using your browser debug option F12 - look at the content type of the file downloaded. I see the following
    image
  3. Save the file. It will save the file as 2009.jpg
  4. Open the file in text editor or hex editor. I see the following
    image

Expected behavior
As the resizing is converting the jpg to a png - I would expect the content type to be image/png
Also if saving the file, I would expect it to save a file called 2009.png instead of 2009.jpg since it is no longer a jpeg.

Desktop (please complete the following information):

  • Browser MS Edge
  • GeoNetwork Version 4.2

Additional context
Content type is set here.

https://github.com/GeoCat/core-geonetwork/blob/126e92f3a73ed12b933e89e2776e7f45c97b0289/services/src/main/java/org/fao/geonet/api/records/attachments/AttachmentsApi.java#L281

The conversion to PNG is done here
https://github.com/GeoCat/core-geonetwork/blob/126e92f3a73ed12b933e89e2776e7f45c97b0289/services/src/main/java/org/fao/geonet/api/records/attachments/AttachmentsApi.java#L287

So I would expect the content type and content disposition to be set accordingly when changing to png.

@juanluisrp juanluisrp added the bug label Dec 12, 2024
@juanluisrp juanluisrp added this to the 4.4.7 milestone Dec 12, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants