mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
fix
This commit is contained in:
+1
-1
Submodule apps/server/src/ee updated: f486726088...05f1c816a8
@@ -571,18 +571,31 @@ export class ImportAttachmentService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if already processed (was referenced in HTML)
|
// Resolve the metadata href to the actual archive path
|
||||||
if (processed.has(href)) {
|
const resolvedHref = resolveRelativeAttachmentPath(
|
||||||
continue;
|
href,
|
||||||
}
|
pageDir,
|
||||||
|
attachmentCandidates,
|
||||||
|
);
|
||||||
|
if (!resolvedHref) continue;
|
||||||
|
|
||||||
// Skip if the file doesn't exist
|
// Check if already processed (was referenced in HTML).
|
||||||
if (!attachmentCandidates.has(href)) {
|
// Inline elements may have been processed under an alias key (original
|
||||||
|
// filename) rather than the numeric archive path, so also check whether
|
||||||
|
// the underlying absolute file path has already been uploaded.
|
||||||
|
const absPath = attachmentCandidates.get(resolvedHref);
|
||||||
|
const alreadyProcessed =
|
||||||
|
processed.has(resolvedHref) ||
|
||||||
|
(absPath &&
|
||||||
|
Array.from(processed.values()).some(
|
||||||
|
(entry) => entry.abs === absPath,
|
||||||
|
));
|
||||||
|
if (alreadyProcessed) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This attachment was in the list but not referenced in HTML - add it
|
// This attachment was in the list but not referenced in HTML - add it
|
||||||
const { attachmentId, apiFilePath, abs } = processFile(href);
|
const { attachmentId, apiFilePath, abs } = processFile(resolvedHref);
|
||||||
const mime = mimeType || getMimeType(abs);
|
const mime = mimeType || getMimeType(abs);
|
||||||
|
|
||||||
// Add as attachment node at the end
|
// Add as attachment node at the end
|
||||||
|
|||||||
Reference in New Issue
Block a user