mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Fix regex
This commit is contained in:
@@ -713,24 +713,30 @@ 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
|
||||||
new RegExp(
|
)
|
||||||
STORAGE_FOLDER_PLACEHOLDER +
|
.replace(
|
||||||
'(' +
|
new RegExp(escapeStringRegexp(path.posix.sep), 'g'),
|
||||||
escapeStringRegexp(path.sep) +
|
path.posix.sep
|
||||||
noteKey +
|
)
|
||||||
')?',
|
.replace(
|
||||||
'g'
|
new RegExp(
|
||||||
),
|
STORAGE_FOLDER_PLACEHOLDER +
|
||||||
DESTINATION_FOLDER
|
'(' +
|
||||||
)
|
escapeStringRegexp(path.sep) +
|
||||||
|
noteKey +
|
||||||
|
')?',
|
||||||
|
'g'
|
||||||
|
),
|
||||||
|
DESTINATION_FOLDER
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user