Harden auth/vault path sanitization and clean WeKnora docs
This commit is contained in:
@@ -783,7 +783,7 @@ export const createSidebarAttachmentOpenRuntime = (dependencies = {}) => {
|
||||
var resolved = await resolveEditorAttachmentUrl(detail);
|
||||
var title = String(detail.fileName || resolved.asset.file_name || 'PDF').trim() || 'PDF';
|
||||
var previewUrl = buildPdfPreviewOpenUrl(resolved.url, title);
|
||||
if (typeof window.__mnoteDocumentPaneRuntime?.openResourceInActiveTab === 'function') {
|
||||
if (typeof window.__mnoteDocumentPaneRuntime?.openResourceInActiveTab === 'async function') {
|
||||
var didOpenPdfTab = await window.__mnoteDocumentPaneRuntime.openResourceInActiveTab({
|
||||
objectIdentity: 'resource:pdf:' + (detail.documentId || '') + ':' + (detail.assetId || previewUrl || resolved.url),
|
||||
assetId: detail.assetId || '',
|
||||
@@ -799,7 +799,7 @@ export const createSidebarAttachmentOpenRuntime = (dependencies = {}) => {
|
||||
}
|
||||
window.open(previewUrl || resolved.url, '_blank', 'noopener,noreferrer');
|
||||
} catch (error) {
|
||||
window.alert(error && error.message ? error.message : '打开 PDF 失败');
|
||||
await window.mnote.alert(error && error.message ? error.message : '打开 PDF 失败');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,7 +848,7 @@ export const createSidebarAttachmentOpenRuntime = (dependencies = {}) => {
|
||||
window.open(resolved.url, '_blank', 'noopener,noreferrer');
|
||||
return;
|
||||
}
|
||||
window.alert(error && error.message ? error.message : '打开代码附件失败');
|
||||
await window.mnote.alert(error && error.message ? error.message : '打开代码附件失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user