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 HTML validation #10354

Merged
merged 2 commits into from
Mar 26, 2019
Merged

Conversation

ClearlyClaire
Copy link
Contributor

@ClearlyClaire ClearlyClaire commented Mar 23, 2019

A possible improvement would be to use fragment.errors to tell why validation failed.

record.errors.add(attribute, I18n.t('html_validator.invalid_markup')) unless valid_html?(value)
errors = html_errors(value)
unless errors.empty?
record.errors.add(attribute, I18n.t('html_validator.invalid_markup', error: errors.first.to_s))
Copy link
Member

Choose a reason for hiding this comment

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

The error message from Nokogiri won't be localized, so I think it might be worthless to show it to the end-user.

@ClearlyClaire
Copy link
Contributor Author

ClearlyClaire commented Mar 25, 2019 via email

@Gargron Gargron merged commit 0c46bd1 into mastodon:master Mar 26, 2019
hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
* Fix HTML validation

* Report first HTML error instead on validation error
messenjahofchrist pushed a commit to Origin-Creative/mastodon that referenced this pull request Jul 30, 2021
* Fix HTML validation

* Report first HTML error instead on validation error
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.

None yet

2 participants