mirror of https://github.com/nocodb/nocodb
Wing-Kam Wong
2 years ago
1 changed files with 2 additions and 0 deletions
@ -1,9 +1,11 @@ |
|||||||
export function sanitize(v) { |
export function sanitize(v) { |
||||||
|
if (typeof v !== 'string') return v; |
||||||
return v?.replace(/([^\\]|^)(\?+)/g, (_, m1, m2) => { |
return v?.replace(/([^\\]|^)(\?+)/g, (_, m1, m2) => { |
||||||
return `${m1}${m2.split('?').join('\\?')}`; |
return `${m1}${m2.split('?').join('\\?')}`; |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
export function unsanitize(v) { |
export function unsanitize(v) { |
||||||
|
if (typeof v !== 'string') return v; |
||||||
return v?.replace(/\\[?]/g, '?'); |
return v?.replace(/\\[?]/g, '?'); |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue