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

Make file filter case-insensitive #1185

Merged
merged 3 commits into from Jul 20, 2020
Merged

Make file filter case-insensitive #1185

merged 3 commits into from Jul 20, 2020

Conversation

Jacalz
Copy link
Member

@Jacalz Jacalz commented Jul 12, 2020

Description:

Currently, a file filter set as ".jpg" would not pick up and files that was saved using ".JPG". This updates the filter to use strings.EqualFold() for case-insensitive lookup.

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.
    • Tested with ".png" and ".PNG" files inside fyne_demo.

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

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

I think this needs some tests.
Should not be too hard to check this method with various URIs

@Jacalz
Copy link
Member Author

Jacalz commented Jul 19, 2020

I added a test for it as you wanted. Should be ready for a re-review now 🙂

@Jacalz Jacalz requested a review from andydotxyz July 19, 2020 16:33
Curently, a file filter set as ".jpg" would not pick up and files that was saved using ".JPG". This updates the filter to use strings.EqualFold() for case-insensitive lookup.
assert.NotNil(t, filter)
assert.Equal(t, true, filter.Matches(storage.NewURI("content:///otherapp/something/pic.JPG")))
assert.Equal(t, true, filter.Matches(storage.NewURI("content:///otherapp/something/pic.jpg")))

Copy link
Member

Choose a reason for hiding this comment

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

Some travis notes report this has stray whitespace :(

@Jacalz Jacalz merged commit 74546f8 into fyne-io:develop Jul 20, 2020
@Jacalz Jacalz deleted the case-insensitive-file-filter branch July 20, 2020 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants