-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Accept images with capitalized extensions. #4474
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
base: main
Are you sure you want to change the base?
Conversation
99ca6a1 to
33e25ea
Compare
|
This is not a problem on Windows at least. I wonder if this is file-manager-specific or a Qt bug? What's your OS/file manager? |
|
I think on windows the file system is case insensitive, so it make sense. |
|
I thought that this worked for me but after testing it now, I can confirm that the gnome file manager (nautilus) doesn't display file extensions that are upper case (edit: I should clarify: it does display them, but not if used with ankis media filter when trying to open the file); which means (though I have very rarely seen upper case file extensions anyways; I thought that's common only on windows) |
GithubAnon0000
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm your solution works. But I'm wondering if its better to add the uppercase versions directly to pics = ("jpg", "jpeg", "png", "gif", "svg", "webp", "ico", "avif").
That way, there would be less computations (potentially faster code) and it's clear at a glance that upper case and lower case extensions are being handeled.
Like this:
pics = (
"jpg", "JPG",
"jpeg", "JPEG",
"png", "PNG",
"gif", "GIF",
"svg", "SVG",
"webp", "WEBP",
"ico", "ICO",
"avif", "AVIF"
)
And for consistency reasons, we probably should do the same for the audio files as well.
They are quite frequent on the internet, I found this problem while downloading pictures from wikipedia, I think something around 1/4 or 1/3 of them are upper case.
I was wondering about it too, I will change it that way if you prefer. |
When using the "Attach pictures/audio/video" button in the "Browse" window, files with a capitalized extension (e.g. image.JPG) aren't selectable. Add the extensions in upper case to the list of supported extensions.
33e25ea to
fbfdfd4
Compare
abdnh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine for now. For consistency, maybe it makes sense to handle this in getFile() in the future, especially since the Python editor will be deprecated in #4029
When using the "Attach pictures/audio/video" button in the "Browse" window, files with a capitalized extension (e.g.
image.JPG) aren't selectable.Add a variable
pics_uppercasewith the extensions in upper case to be used when selecting a media.I modified only the places where pics (the list of supported extensions) was used with the funciton "getFile": on the other places, the text is converted to lowercase before comparing.
I did only handle the pictures, because I don't think I ever saw a audio file with a capitalized extension, while for pictures it is very common (1/3 of the pictures I downloaded for my deck where ".JPG").