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

fix: support mixed-case extensions in Linux file dialogs #33918

Merged

Conversation

kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Apr 25, 2022

Description of Change

Closes #33844.

Checklist

Release Notes

Notes: Fixed an issue where mixed-case extension filters in file dialogs were ignored on Linux.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Apr 25, 2022
@zcbenz zcbenz added semver/patch backwards-compatible bug fixes target/17-x-y labels Apr 27, 2022
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Apr 27, 2022
@zcbenz zcbenz requested a review from ckerr April 27, 2022 02:55
std::string upper_file_extension = base::ToUpperASCII("*." + extension);
gtk_file_filter_add_pattern(gtk_filter, upper_file_extension.c_str());

// if we received a mixed-case extension, add that extension as-is
Copy link
Member

@RaisinTen RaisinTen Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the filter is set to Foo, it would still not catch files with the extension fOO. Is that expected or should we convert the extension to *.[fF][oO][oO] instead in which case it would catch all such files regardless of the casing?

FYI, my suggestion is put into practice in projects like Firefox in here, and this is how they convert the string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems reasonable to me. Should I adjust my PR to that effect?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, unless there are any objections from anyone

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've updated the PR following the aforementioned implementation.

@kevinushey kevinushey force-pushed the bugfix/file-filter-mixed-case-extensions branch from 3993f59 to 7366bf0 Compare April 28, 2022 03:07
@kevinushey
Copy link
Contributor Author

I think this PR should be ready to go; the associated build failures on AppVeyor appear to be unrelated. Please let me know if there are any other changes I can make to get this over the finish line.

Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new implementation looks good to me 👍

@jkleinsc
Copy link
Contributor

jkleinsc commented May 2, 2022

Merging as CI failure unrelated to PR change.

@jkleinsc jkleinsc merged commit 9901d2f into electron:main May 2, 2022
@release-clerk
Copy link

release-clerk bot commented May 2, 2022

Release Notes Persisted

Fixed an issue where mixed-case extension filters in file dialogs were ignored on Linux.

@trop
Copy link
Contributor

trop bot commented May 2, 2022

I was unable to backport this PR to "17-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented May 2, 2022

I have automatically backported this PR to "19-x-y", please check out #34015

@trop
Copy link
Contributor

trop bot commented May 2, 2022

I have automatically backported this PR to "18-x-y", please check out #34016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: File Selection Dialog Filter Issue on Linux
5 participants