Skip to content

Commit

Permalink
fix: norm NFC for subject comment (#695)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Dec 29, 2024
1 parent 234f790 commit 1ce1236
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/collections/domain/collection/subject.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (s *Subject) UpdateComment(comment string) error {
return gerr.ErrInvisibleChar
}

s.comment = norm.NFKC.String(comment)
s.comment = norm.NFC.String(comment)

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/subject/mysql_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestBrowse(t *testing.T) {
}
s, err := repo.Browse(context.Background(), filter, 30, 0)
require.NoError(t, err)
require.Equal(t, 12, len(s))
require.Equal(t, 17, len(s))

filter = subject.BrowseFilter{
Type: 1,
Expand Down
2 changes: 1 addition & 1 deletion web/req/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (v *SubjectEpisodeCollectionPatch) Validate() error {
}

if v.Comment.Set {
v.Comment.Value = norm.NFKC.String(v.Comment.Value)
v.Comment.Value = norm.NFC.String(v.Comment.Value)
v.Comment.Value = strings.TrimSpace(v.Comment.Value)
if !dam.AllPrintableChar(v.Comment.Value) {
return res.BadRequest("invisible character are included in comment")
Expand Down

0 comments on commit 1ce1236

Please sign in to comment.