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 Cleaner#clean_url with mailto links #813

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

imjoehaines
Copy link
Contributor

Goal

mailto links don't have a query property, instead they use headers, e.g.:

uri = URI('mailto:[email protected]?subject=hi')
uri.headers #=> [['subject', 'hi']]

The current Cleaner#clean_url fails on mailto links and wouldn't filter the headers if it did succeed. This PR updates it to handle filtering the headers in mailto links

Copy link
Contributor

@tomlongridge tomlongridge left a comment

Choose a reason for hiding this comment

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

Changelog entry needed, but fix LGTM

@imjoehaines imjoehaines changed the base branch from master to next January 24, 2024 09:40
@imjoehaines imjoehaines merged commit 80b4a80 into next Jan 24, 2024
137 checks passed
@imjoehaines imjoehaines deleted the fix-clean-url-with-mailto-links branch January 24, 2024 09:40
@imjoehaines imjoehaines mentioned this pull request Jan 24, 2024
else
clean_generic_url(url, uri)
"#{pre_query_string}?#{FILTERED}"
rescue StandardError
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonderful! Thanks for this.

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.

3 participants