fix: restore page links after delayed materialization
This commit is contained in:
@@ -461,6 +461,8 @@ const PUBLIC_HTML_MARKDOWN_LINK_PATTERN =
|
||||
const MARKDOWN_LINK_PATTERN = /\[([^\]\n]*)\]\((https?:\/\/[^\s<>"')\]]+)\)/g;
|
||||
const PLAIN_HTML_URL_PATTERN = /https?:\/\/[^\s<>"')\]]+\.html/gi;
|
||||
const INLINE_PUBLIC_HTML_PATH_PATTERN = /`((?:\.\/)?public\/[^`\s<>"')\]]+\.html)`/gi;
|
||||
const MISSING_PUBLIC_HTML_NOTICE_PATTERN =
|
||||
/(页面生成未完成,已阻止显示失效链接:([^()\n]+\.html)。)/g;
|
||||
const USER_IDENTITY_BLOCK_PATTERN = /^\[用户身份\][\s\S]*?(?:\n{2,}|$)/;
|
||||
const IMAGE_URL_LINES_PATTERN = /\n*\[图片\d+]: [^\n]+/g;
|
||||
const TKMIND_VISION_NOTE_PATTERN = /\n*【TKMind 图片分析结果[\s\S]*$/;
|
||||
@@ -606,6 +608,13 @@ function rewriteOwnPublicationRouteLinks(text, currentUser) {
|
||||
|
||||
export function sanitizePublicHtmlLinksInText(text, currentUser) {
|
||||
let next = String(text ?? '').replace(
|
||||
MISSING_PUBLIC_HTML_NOTICE_PATTERN,
|
||||
(match, filename) => {
|
||||
const result = sanitizeOwnPublicHtmlRelativePath(`public/${path.posix.basename(filename)}`, currentUser);
|
||||
return result ? `[${result.label}](${result.url})` : match;
|
||||
},
|
||||
);
|
||||
next = next.replace(
|
||||
PUBLIC_HTML_MARKDOWN_LINK_PATTERN,
|
||||
(match, label, url, owner, rawRelativePath) => {
|
||||
const result = sanitizeOwnPublicHtmlUrl(url, owner, rawRelativePath, currentUser);
|
||||
|
||||
Reference in New Issue
Block a user