-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 8241-mime
- Loading branch information
Showing
5 changed files
with
50 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 14 additions & 7 deletions
21
src/main/resources/db/migration/V5.8.0.2__8018-invalid-characters.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
-- This list of characters also appears in DatasetFieldValidator.java | ||
-- Remove character: form feed (\f) | ||
UPDATE datasetfieldvalue SET value = regexp_replace(value, E'\f', '', 'g'); | ||
-- Remove character: start of text (\u0002) | ||
UPDATE datasetfieldvalue SET value = regexp_replace(value, U&'\0002', '', 'g'); | ||
-- Remove character: not a character (\ufffe) | ||
UPDATE datasetfieldvalue SET value = regexp_replace(value, U&'\FFFE', '', 'g'); | ||
DO $$ | ||
BEGIN | ||
-- Run on UTF8 only. It's known to fail on SQL_ASCII encoding. | ||
IF EXISTS (SELECT 1 FROM information_schema.character_sets WHERE character_set_name='UTF8') THEN | ||
-- This list of characters also appears in DatasetFieldValidator.java | ||
-- Remove character: form feed (\f) | ||
UPDATE datasetfieldvalue SET value = regexp_replace(value, E'\f', '', 'g'); | ||
-- Remove character: start of text (\u0002) | ||
UPDATE datasetfieldvalue SET value = regexp_replace(value, U&'\0002', '', 'g'); | ||
-- Remove character: not a character (\ufffe) | ||
UPDATE datasetfieldvalue SET value = regexp_replace(value, U&'\FFFE', '', 'g'); | ||
END IF; | ||
END | ||
$$ |