Skip to content

refactor(sanitizer): always trim spaces in StripTags#4359

Merged
fguillot merged 1 commit into
miniflux:mainfrom
gudvinr:feature/strip_trim
May 26, 2026
Merged

refactor(sanitizer): always trim spaces in StripTags#4359
fguillot merged 1 commit into
miniflux:mainfrom
gudvinr:feature/strip_trim

Conversation

@gudvinr

@gudvinr gudvinr commented May 24, 2026

Copy link
Copy Markdown
Contributor

Little follow-up to #4287.

Outputs of StripTags and TruncateHTML never used without being trimmed.
So instead of trimming spaces outside at every call just do it inside.


Have you followed these guidelines?

Comment on lines +86 to +91
if value = sanitizer.TruncateHTML(value, 100); value == "" {
continue
}

entry.Title = value
break

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's wrong with

Suggested change
if value = sanitizer.TruncateHTML(value, 100); value == "" {
continue
}
entry.Title = value
break
if value = sanitizer.TruncateHTML(value, 100); value != "" {
entry.Title = value
break
}

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Personal preference, really. Makes more sense with #4356.

If you're interested in why the flatter code the better, see uudashr/gocognit with corresponding article and maybe see bkielbasa/cyclop too.

Not dying on that hill though, will make whatever fits here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No strong opinion either way, I was just curious

It's never used without being trimmed anyway
@gudvinr gudvinr force-pushed the feature/strip_trim branch from 12286c4 to 71338e1 Compare May 25, 2026 17:31
@fguillot fguillot merged commit d235a63 into miniflux:main May 26, 2026
11 checks passed
@gudvinr gudvinr deleted the feature/strip_trim branch May 26, 2026 07:49
dsh2dsh added a commit to dsh2dsh/miniflux that referenced this pull request May 26, 2026
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.

3 participants