Skip to content

Commit

Permalink
Strip \u0000 unicode character when submitting notices
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-hank committed May 13, 2022
1 parent 5309796 commit d819ed9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). It uses [CalVer](https://calver.org/) as of May 2019.

## [22.05b](https://github.com/berkmancenter/lumendatabase/releases/tag/2022.05b) - 2022-05-13
### Fixed
* Started stripping `\u0000` unicode characters when submitting new notices. PostgreSQL doesn't like it.

## [22.05a](https://github.com/berkmancenter/lumendatabase/releases/tag/2022.05a) - 2022-05-13
### Changed
* Stopped using the `infringing_urls`, `copyrighted_url` and `works` database tables. Moved to `jsonb` fields in the `notices` table.
Expand Down
3 changes: 2 additions & 1 deletion app/models/notice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ def prep_work_json(work)
json[:description_original] = work.description_original
end

json
# FIXME Find a way to do this in the middleware to avoid Hash <> JSON conversion
JSON.parse(json.to_json.gsub(/\\u0000/, ''))
end

def prep_url_json(url_instance)
Expand Down

0 comments on commit d819ed9

Please sign in to comment.