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

Extend comment validation for invalid xml characters (closes #16302) #16304

Closed
wants to merge 3 commits into from

Conversation

frozenIceage
Copy link

@frozenIceage frozenIceage commented Jun 10, 2024

Fixes #16302

@github-actions github-actions bot added the Frontend Things related to the OBS RoR app label Jun 10, 2024
@danidoni
Copy link
Contributor

The minitest tests are failing, if you need help, just say it...

@@ -8,8 +8,8 @@ class Comment < ApplicationRecord
validates :body, presence: true
# FIXME: this probably should be MEDIUMTEXT(16MB) instead of text (64KB)
validates :body, length: { maximum: 65_535 }
validates :body, format: { with: /\A[^\u0000]*\Z/,
message: 'must not contain null characters' }
validates :body, format: { with: /\A[\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}]*\Z/,
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't exactly fix the existing data, is there no way to escape these characters when rendering xmls?

@frozenIceage
Copy link
Author

The minitest tests are failing, if you need help, just say it...

Thanks! Need some time to set up my local development environment first, let me close it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frontend Things related to the OBS RoR app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate Comment body before saving it to DB
3 participants