mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Clean extra non-printable chars (#4110)
- \x00 (null character) - \x7F (DEL character)
This commit is contained in:
parent
95dc78a61f
commit
bc6b232d7c
@ -966,8 +966,8 @@ def remove_non_printable_characters(value: str, remove_newline=True, remove_asci
|
||||
if remove_ascii:
|
||||
# Remove ASCII control characters
|
||||
# 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'[\x0b-\x1F]+', '', cleaned)
|
||||
cleaned = regex.sub(u'[\x00-\x09]+', '', cleaned)
|
||||
cleaned = regex.sub(u'[\x0b-\x1F\x7F]+', '', cleaned)
|
||||
|
||||
if remove_newline:
|
||||
cleaned = regex.sub(u'[\x0a]+', '', cleaned)
|
||||
|
@ -456,7 +456,7 @@ function sanitizeInputString(s, options={}) {
|
||||
}
|
||||
|
||||
// Remove ASCII control characters
|
||||
s = s.replace(/[\x01-\x1F]+/g, '');
|
||||
s = s.replace(/[\x00-\x1F\x7F]+/g, '');
|
||||
|
||||
// Remove Unicode control characters
|
||||
s = s.replace(/[\p{C}]+/gu, '');
|
||||
|
Loading…
Reference in New Issue
Block a user