fix: Handle base64 and remote images when creating a file (#5740)

This commit is contained in:
Tom Moor
2023-08-26 09:15:14 -04:00
committed by GitHub
parent c643f62d96
commit 78ad1b867a
15 changed files with 292 additions and 198 deletions

View File

@@ -1,5 +1,6 @@
import truncate from "lodash/truncate";
import {
AttachmentPreset,
CollectionPermission,
CollectionSort,
FileOperationState,
@@ -243,6 +244,7 @@ export default abstract class ImportTask extends BaseTask<Props> {
Logger.debug("task", `ImportTask persisting attachment ${item.id}`);
const attachment = await attachmentCreator({
source: "import",
preset: AttachmentPreset.DocumentAttachment,
id: item.id,
name: item.name,
type: item.mimeType,
@@ -251,7 +253,9 @@ export default abstract class ImportTask extends BaseTask<Props> {
ip,
transaction,
});
attachments.set(item.id, attachment);
if (attachment) {
attachments.set(item.id, attachment);
}
})
);