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

Use add_pattern over add_mime_type for FileFilters #3221

Merged
merged 3 commits into from
Mar 25, 2024

Conversation

TomChapple
Copy link
Contributor

@TomChapple TomChapple commented Dec 28, 2023

Description

Since 51.0, functionality with importing Bottle configurations via a YAML file have shown strange symptoms on a subset of Linux distributions. Until 51.5, this was limited to being unable to choose "All Files" as an option, but versions 51.6-51.10 now result in no filter being available, resulting in a complete inability to choose a YAML file. Attempts to circumvent this result in errors. Upon further investigation, it was found such symptoms existed on all file chooser dialogs.

After investigation, it was found that these versions differed in how the file patterns were defined. In 51.0+, the add_mime_type function is used whereas version 50.2 uses add_pattern for the YAML file filter. Reverting these filters to using add_pattern results in the filters now appearing as intended and being fully functional.

This comes with an unfortunate caveat in avoiding (what I believe to be) best practice in using the equivalent media types and their internationalised descriptions. However, I believe that this is necessary in order to preserve the intended functionality.

It is unknown why this problem happens in the first place as local proof of concepts using this same protocol do not experience the same issue. My hope is that this pull request would eventually be made redundant when the true cause for this issue is discovered and addressed.

Fixes #3154

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Start Bottles and create a new bottle. Choose a custom configuration and proceed to the file dialog for choosing a YAML file. Observe that the list of filters include "YAML" and "All Files".
  • Verify this on SteamOS that experienced this issue previously.
  • Verify this on a Linux distribution that did not experience this issue previously.

Since using `add_mime_type` in 51.0, certain Linux distributions do not
show file filters correctly (i.e. the filters for what files can be
chosen). In its worst case, no files can be chosen.

Using `add_pattern` for the equivalent MIME types works as intended for
these distributions.

It is unknown why using `add_mime_type` causes this issue to occur as
minimal programs using this same protocol work as intended.
Copy link

fab-sonarqube bot commented Dec 28, 2023

@TomChapple
Copy link
Contributor Author

As mentioned in the description, it would be best to verify that this bugfix I have submitted works both on the SteamOS version that was originally reported and on distributions that were not experiencing the issue originally. Testing this would require a local development environment, however, requiring that the branch in question is cloned and the following commands run (addressing any missing dependencies as they are found):

flatpak run org.flatpak.Builder --install --user --force-clean ./.flatpak-builder/out com.usebottles.bottles.yml
flatpak run --devel --allow=devel com.usebottles.bottles//master

As I do not have a Steam Deck or another device running SteamOS, any help would be greatly appreciated in verifying this fixes functionality.

@eskay993
Copy link

eskay993 commented Jan 21, 2024

Thanks for this! I've tested your change on Steam Deck and can confirm it works great. I am now able to see the yaml in the file picker, and selecting it correctly loads the config.

I am unable to Verify this on a Linux distribution that did not experience this issue previously as every distro I use is experiencing this issue (which this PR seems to fix on all I've tested).

@TomChapple
Copy link
Contributor Author

Hi! Given that this has been verified both on a Steam Deck and a non-Steam Deck that experienced this issue, could this be verified by a maintainer to ensure it continues to work as intended for those not experiencing the issue?

@mirkobrombin mirkobrombin merged commit 75b3873 into bottlesdevs:main Mar 25, 2024
0 of 5 checks passed
@TomChapple TomChapple deleted the mime-to-pattern-filters branch March 26, 2024 06:24
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.

[Bug]: Unable to find .yml files.
3 participants