Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
open-build-service
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
obs
open-build-service
Commits
3128820f
Unverified
Commit
3128820f
authored
6 years ago
by
Henne Vogelsang
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #6050 from hennevogel/bugfix/nullbytes
Fix xml output for comments
parents
a344d8cd
8ca9200b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ReleaseNotes-2.9.5
+2
-1
2 additions, 1 deletion
ReleaseNotes-2.9.5
src/api/app/models/comment.rb
+3
-0
3 additions, 0 deletions
src/api/app/models/comment.rb
with
5 additions
and
1 deletion
ReleaseNotes-2.9.5
+
2
−
1
View file @
3128820f
...
...
@@ -19,7 +19,8 @@ Bugfixes
========
Frontend:
*
* Do not allow null characters in comments
* Prevent creation of a request with an ID attribute
Backend:
* avoid wipebinaries in locked projects
...
...
This diff is collapsed.
Click to expand it.
src/api/app/models/comment.rb
+
3
−
0
View file @
3128820f
...
...
@@ -7,6 +7,8 @@ class Comment < ApplicationRecord
validates
:body
,
:commentable
,
:user
,
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'
}
validate
:validate_parent_id
...
...
@@ -64,6 +66,7 @@ class Comment < ApplicationRecord
def
to_xml
(
builder
)
attrs
=
{
who:
user
,
when:
created_at
,
id:
id
}
attrs
[
:parent
]
=
parent_id
if
parent_id
body
.
delete!
(
"
\u
0000"
)
builder
.
comment_
(
attrs
)
do
builder
.
text
(
body
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment