fixes for web clipper

This commit is contained in:
zadam
2020-04-02 22:55:11 +02:00
parent bab657e43d
commit 3bbb213f82
5 changed files with 27 additions and 9 deletions

View File

@@ -166,6 +166,12 @@ function isStringNote(type, mime) {
|| STRING_MIME_TYPES.includes(mime);
}
function replaceAll(string, replaceWhat, replaceWith) {
const escapedWhat = replaceWhat.replace(/([\/,!\\^${}\[\]().*+?|<>\-&])/g, "\\$&");
return string.replace(new RegExp(escapedWhat, "g"), replaceWith);
}
module.exports = {
randomSecureToken,
randomString,
@@ -191,5 +197,6 @@ module.exports = {
crash,
sanitizeFilenameForHeader,
getContentDisposition,
isStringNote
isStringNote,
replaceAll
};