1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 02:06:29 +00:00

Fix regex

This commit is contained in:
Junyoung Choi
2020-04-16 00:07:45 +09:00
parent ac2cfe5169
commit 461e24bf39

View File

@@ -713,14 +713,20 @@ function replaceNoteKeyWithNewNoteKey(noteContent, oldNoteKey, newNoteKey) {
*/ */
function removeStorageAndNoteReferences(input, noteKey) { function removeStorageAndNoteReferences(input, noteKey) {
return input.replace( return input.replace(
new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '.*?("|])', 'g'), new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '.*?("|\\))', 'g'),
function(match) { function(match) {
const temp = match return match
.replace(new RegExp(mdurl.encode(path.win32.sep), 'g'), path.sep) .replace(new RegExp(mdurl.encode(path.win32.sep), 'g'), path.posix.sep)
.replace(new RegExp(mdurl.encode(path.posix.sep), 'g'), path.sep) .replace(new RegExp(mdurl.encode(path.posix.sep), 'g'), path.posix.sep)
.replace(new RegExp(escapeStringRegexp(path.win32.sep), 'g'), path.sep) .replace(
.replace(new RegExp(escapeStringRegexp(path.posix.sep), 'g'), path.sep) new RegExp(escapeStringRegexp(path.win32.sep), 'g'),
return temp.replace( path.posix.sep
)
.replace(
new RegExp(escapeStringRegexp(path.posix.sep), 'g'),
path.posix.sep
)
.replace(
new RegExp( new RegExp(
STORAGE_FOLDER_PLACEHOLDER + STORAGE_FOLDER_PLACEHOLDER +
'(' + '(' +