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

Drag and drop picture editor can't recognize JPG in uppercase #68104

Closed
xiaoliang6669 opened this issue Nov 1, 2022 · 9 comments · Fixed by #68107
Closed

Drag and drop picture editor can't recognize JPG in uppercase #68104

xiaoliang6669 opened this issue Nov 1, 2022 · 9 comments · Fixed by #68107

Comments

@xiaoliang6669
Copy link

Godot version

4.0-beta3

System information

win10

Issue description

Drag and drop picture editor can't recognize JPG in uppercase

Steps to reproduce

6666

Minimal reproduction project

No response

@alfredbaudisch
Copy link
Contributor

alfredbaudisch commented Nov 1, 2022

I can't reproduce. Check whether the underlying image is really a JPG or if it just has the extension.

Quickest way to check it I can recommend is to drag it here: https://www.metadata2go.com/

Mime should be an image/jpeg or image/jpg:

image

@xiaoliang6669
Copy link
Author

222

@akien-mga
Copy link
Member

Can you attach that file in this issue (e.g. in a zip to ensure the metadata isn't changed by GitHub)?

@xiaoliang6669
Copy link
Author

1.zip

@akien-mga
Copy link
Member

I can confirm the issue. The file is properly imported and gets a thumbnail, but drag and drop to the CanvasItem editor doesn't work. Drag and drop in a texture slot works fine. Changing the extension to .jpg does fix it.

@xiaoliang6669
Copy link
Author

I know it can be solved by changing it to lower case. I hope it can be compatible with upper case

@alfredbaudisch
Copy link
Contributor

alfredbaudisch commented Nov 1, 2022

@akien-mga ResourceLoader::get_recognized_extensions_for_type deals only with lowercase extensions across the board, it's not only a problem for dragging and dropping.

I could fix it in two ways:

  1. Either cast the file name extension being dragged to lowercase (but only when making the extension check, the name will be preserved afterward)
  2. Or duplicate extensions when calling get_recognized_extensions_for_type, adding both lowercase and uppercase extensions to the list, here: https://github.com/godotengine/godot/blob/master/core/core_bind.cpp#L81

(1) is easy and I could do right away, but (2) affects the core - so since this would be a big change, how are these big changes decided if they should be a go or no go or should I just make a PR with (2) and wait for review?

@akien-mga
Copy link
Member

(2) is not a good option because you would also need to support Jpg, JpG, etc.

Extension tests should always be done with lowercased filenames, seems like this is just missing here for the drag and drop code.

@alfredbaudisch
Copy link
Contributor

(2) is not a good option because you would also need to support Jpg, JpG, etc.

Oh definitely! 💯

Extension tests should always be done with lowercased filenames, seems like this is just missing here for the drag and drop code.

Done then #68107

@akien-mga akien-mga modified the milestones: 4.0, 3.6 Nov 2, 2022
akien-mga pushed a commit to akien-mga/godot that referenced this issue Nov 30, 2022
timothyqiu pushed a commit to timothyqiu/godot that referenced this issue Dec 5, 2022
Riordan-DC pushed a commit to Riordan-DC/godot that referenced this issue Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants