From ae9e109c463e8b83fc10b5ea18ce9ca70a4d506e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=9B=BD=E7=92=87?= <37972689+YangGuoXuan-0503@users.noreply.github.com> Date: Mon, 17 Mar 2025 12:50:50 +0800 Subject: [PATCH] fix: reg (#7620) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 杨国璇 --- .../components/cell-editors/long-text-editor/api.js | 2 +- frontend/src/pages/markdown-editor/editor-api.js | 2 +- frontend/src/utils/utils.js | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/metadata/components/cell-editors/long-text-editor/api.js b/frontend/src/metadata/components/cell-editors/long-text-editor/api.js index 952b369794..ce92539069 100644 --- a/frontend/src/metadata/components/cell-editors/long-text-editor/api.js +++ b/frontend/src/metadata/components/cell-editors/long-text-editor/api.js @@ -60,7 +60,7 @@ class LongtextAPI { isInternalDirLink(url) { // eslint-disable-next-line - var re = new RegExp(this.serviceUrl + '/library/' + '[0-9a-f\-]{36}.*'); + var re = new RegExp(this.serviceUrl + '/library/' + '[0-9a-f-]{36}.*'); return re.test(url); } diff --git a/frontend/src/pages/markdown-editor/editor-api.js b/frontend/src/pages/markdown-editor/editor-api.js index 038903ac8a..b858bfabfe 100644 --- a/frontend/src/pages/markdown-editor/editor-api.js +++ b/frontend/src/pages/markdown-editor/editor-api.js @@ -95,7 +95,7 @@ class EditorApi { isInternalDirLink(url) { // eslint-disable-next-line - var re = new RegExp(serviceUrl + '/library/' + '[0-9a-f\-]{36}.*'); + var re = new RegExp(serviceUrl + '/library/' + '[0-9a-f-]{36}.*'); return re.test(url); } diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index 7aac7e2251..1cf61158d3 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -1088,7 +1088,7 @@ export const Utils = { isInternalMarkdownLink: function (url, repoID) { // eslint-disable-next-line - var re = new RegExp(serviceURL + '/lib/' + repoID + '.*\.md$'); + var re = new RegExp(serviceURL + '/lib/' + repoID + '.*(\\.md)$'); return re.test(url); }, @@ -1099,7 +1099,7 @@ export const Utils = { getPathFromInternalMarkdownLink: function (url, repoID) { // eslint-disable-next-line - var re = new RegExp(serviceURL + '/lib/' + repoID + '/file' + '(.*\.md)'); + var re = new RegExp(serviceURL + '/lib/' + repoID + '/file' + '.*(\\.md)$'); var array = re.exec(url); var path = decodeURIComponent(array[1]); return path; @@ -1117,7 +1117,7 @@ export const Utils = { isWikiInternalMarkdownLink: function (url, slug) { slug = encodeURIComponent(slug); // eslint-disable-next-line - var re = new RegExp(serviceURL + '/published/' + slug + '.*\.md$'); + var re = new RegExp(serviceURL + '/published/' + slug + '.*(\\.md)$'); return re.test(url); }, @@ -1130,7 +1130,7 @@ export const Utils = { getPathFromWikiInternalMarkdownLink: function (url, slug) { slug = encodeURIComponent(slug); // eslint-disable-next-line - var re = new RegExp(serviceURL + '/published/' + slug + '(.*\.md)'); + var re = new RegExp(serviceURL + '/published/' + slug + '.*(\\.md)$'); var array = re.exec(url); var path = array[1]; try {