Skip to content

Commit

Permalink
Minor cleaning in AttachmentFileManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Spoffy committed Jan 20, 2025
1 parent 4b733b3 commit 5fde08f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/server/lib/AttachmentFileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class AttachmentFileManager implements IAttachmentFileManager {
const fileMetadata = await this._docStorage.getFileInfoNoData(fileIdent);
// This check runs before the file is retrieved as an optimisation to avoid loading files into
// memory unnecessarily.
if (!fileMetadata || fileMetadata.storageId == newStoreId) {
if (!fileMetadata || (fileMetadata.storageId ?? undefined) === newStoreId) {
return;
}
// It's possible that the record has changed between the original metadata check and here.
Expand Down Expand Up @@ -258,8 +258,7 @@ export class AttachmentFileManager implements IAttachmentFileManager {
await this.transferFileToOtherStore(fileIdent, targetStoreId);
} catch(e) {
this._log.warn({ fileIdent, storeId: targetStoreId }, `transfer failed: ${e.message}`);
}
finally {
} finally {
// If a transfer request comes in mid-transfer, it will need re-running.
if (this._pendingFileTransfers.get(fileIdent) === targetStoreId) {
this._pendingFileTransfers.delete(fileIdent);
Expand Down

0 comments on commit 5fde08f

Please sign in to comment.