Browse Source

fix: file size on upload via url

nc-feat/attachment-clean-up
mertmit 4 months ago
parent
commit
518181ffcc
  1. 32
      packages/nocodb/src/services/attachments.service.ts

32
packages/nocodb/src/services/attachments.service.ts

@ -243,22 +243,6 @@ export class AttachmentsService {
},
);
await FileReference.insert(
{
workspace_id: RootScopes.ROOT,
base_id: RootScopes.ROOT,
},
{
storage: storageAdapter.constructor.name,
file_url:
attachmentUrl ??
path.join('download', filePath.join('/'), fileName),
file_size: file.size,
fk_user_id: userId,
deleted: true, // root file references are always deleted as they are not associated with any record
},
);
const tempMetadata: {
width?: number;
height?: number;
@ -292,6 +276,22 @@ export class AttachmentsService {
}
}
await FileReference.insert(
{
workspace_id: RootScopes.ROOT,
base_id: RootScopes.ROOT,
},
{
storage: storageAdapter.constructor.name,
file_url:
attachmentUrl ??
path.join('download', filePath.join('/'), fileName),
file_size: size ? parseInt(size) : urlMeta.size,
fk_user_id: userId,
deleted: true, // root file references are always deleted as they are not associated with any record
},
);
const attachment: AttachmentObject = {
...(attachmentUrl
? { url: attachmentUrl }

Loading…
Cancel
Save