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

Strip Addon Project URLs #1981

Conversation

stevenyoungs
Copy link
Contributor

Leading and trailing whitespaces in the URL causes problems as discussed here

Call strip on any new URLs enter by the user.
For additional safety, call strip when loading already configured projects.

whitespace causes problems so strip, as gramps does for some other input fields
@@ -431,6 +431,9 @@ def __init__(self, dbstate, uistate, track):
hbox.pack_start(self.addon_combo, False, False, 0)

self.projects = config.get("behavior.addons-projects")
# strip the incoming URLs to avoid any leading or trailing whitespace
for project in self.projects:
project[1] = project[1].strip()
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to ensure that urls were stripped of whitespace before storing in the preferences.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the current approach all URLs are stripped on the way in to gramps (either from the preference - this code, or when a new URL is entered by the user - the other change in this PR). Therefore I don't think there is any need to strip when storing in the preferences. As a by product the URLs are whitespace free during the lifetime of the addon manager dialog.
Stripping URLs when reading the preference covers the scenario of an upgraded 5.2 preference file already containing whitespace on the URLs.

@Nick-Hall Nick-Hall added this to the v6.0 milestone Feb 17, 2025
@Nick-Hall
Copy link
Member

Closed in favour of PR #1991.

@Nick-Hall Nick-Hall closed this Feb 19, 2025
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.

2 participants