2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 21:45:39 +00:00

Clean extra non-printable chars ()

- \x00 (null character)
- \x7F (DEL character)
This commit is contained in:
Oliver
2022-12-26 23:49:55 +11:00
committed by GitHub
parent 95dc78a61f
commit bc6b232d7c
2 changed files with 3 additions and 3 deletions
InvenTree
InvenTree
templates
js
translated

@ -966,8 +966,8 @@ def remove_non_printable_characters(value: str, remove_newline=True, remove_asci
if remove_ascii: if remove_ascii:
# Remove ASCII control characters # Remove ASCII control characters
# Note that we do not sub out 0x0A (\n) here, it is done separately below # Note that we do not sub out 0x0A (\n) here, it is done separately below
cleaned = regex.sub(u'[\x01-\x09]+', '', cleaned) cleaned = regex.sub(u'[\x00-\x09]+', '', cleaned)
cleaned = regex.sub(u'[\x0b-\x1F]+', '', cleaned) cleaned = regex.sub(u'[\x0b-\x1F\x7F]+', '', cleaned)
if remove_newline: if remove_newline:
cleaned = regex.sub(u'[\x0a]+', '', cleaned) cleaned = regex.sub(u'[\x0a]+', '', cleaned)

@ -456,7 +456,7 @@ function sanitizeInputString(s, options={}) {
} }
// Remove ASCII control characters // Remove ASCII control characters
s = s.replace(/[\x01-\x1F]+/g, ''); s = s.replace(/[\x00-\x1F\x7F]+/g, '');
// Remove Unicode control characters // Remove Unicode control characters
s = s.replace(/[\p{C}]+/gu, ''); s = s.replace(/[\p{C}]+/gu, '');