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

Cleanup a bit sanitize.go #2978

Merged
merged 9 commits into from
Dec 8, 2024
Merged

Cleanup a bit sanitize.go #2978

merged 9 commits into from
Dec 8, 2024

Conversation

jvoisin
Copy link
Collaborator

@jvoisin jvoisin commented Dec 7, 2024

This PR should be reviewed commit by commit, and was done as part of #2900 to make the code easier to reason about, in order to optimize it in a follow-up PR.

The `isAnchor` function's first parameter was always `a`, instead of being
passed `tagName`. As this function is a single line and was only called in a
single place, it can be inlined.
- Use `token.String()` instead of `html.EscapeString(token.Data)`
- Refactor conditions to highlight their similitude, enabling further
  refactoring

This refactoring brings forth at least one bug: `tagStack` is never emptied.
@fguillot fguillot merged commit 2f56ebd into miniflux:main Dec 8, 2024
16 checks passed
@jvoisin jvoisin deleted the cleanup_sanitize branch December 26, 2024 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants