Skip to content

Commit

Permalink
Improves several checks
Browse files Browse the repository at this point in the history
Co-authored-by: Florent <[email protected]>
  • Loading branch information
Spoffy and fflorent authored Jan 14, 2025
1 parent 1ffeb45 commit ca0ee2d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/server/lib/AttachmentFileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class AttachmentRetrievalError extends Error {
constructor(storeId: AttachmentStoreId | null, fileId: string, cause?: any) {
const causeError = cause instanceof Error ? cause : undefined;
const reason = (causeError ? causeError.message : cause) ?? "";
const storeName = storeId? `'${storeId}'` : "internal storage";
const storeName = storeId ? `'${storeId}'` : "internal storage";
super(`Unable to retrieve '${fileId}' from ${storeName} ${reason}`);
this.storeId = storeId;
this.fileId = fileId;
Expand Down Expand Up @@ -178,7 +178,7 @@ export class AttachmentFileManager implements IAttachmentFileManager {
}

const fileIdents = filesToTransfer.map(file => file.ident);
for(const fileIdent of fileIdents) {
for (const fileIdent of fileIdents) {
this.startTransferringFileToOtherStore(fileIdent, newStoreId);
}
}
Expand Down Expand Up @@ -250,7 +250,7 @@ export class AttachmentFileManager implements IAttachmentFileManager {
}

private _runTransferJob(): TransferJob {
if (this._transferJob && !this._transferJob.isFinished) {
if (this.transferStatus().isRunning) {
return this._transferJob;

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (3.11, 22.x, :nbrowser-^[M-N]:)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (3.11, 22.x, :nbrowser-^[O-R]:)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (3.11, 22.x, :server-1-of-2:)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (3.11, 22.x, :nbrowser-^[A-D]:)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (3.11, 22.x, :nbrowser-^[E-L]:)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (3.11, 22.x, :nbrowser-^[^A-R]:)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (3.11, 22.x, :server-2-of-2:)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (3.11, 22.x, :gen-server:)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (3.11, 22.x, :lint:python:client:common:smoke:stubs:)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.

Check failure on line 254 in app/server/lib/AttachmentFileManager.ts

View workflow job for this annotation

GitHub Actions / build_and_test (:lint:python:client:common:smoke:, 22.x, 3.10)

Type 'TransferJob | undefined' is not assignable to type 'TransferJob'.
}
const transferPromise = this._performPendingTransfers();
Expand Down Expand Up @@ -278,7 +278,7 @@ export class AttachmentFileManager implements IAttachmentFileManager {
}
finally {
// If a transfer request comes in mid-transfer, it will need re-running.
if (this._pendingFileTransfers.get(fileIdent) == targetStoreId) {
if (this._pendingFileTransfers.get(fileIdent) === targetStoreId) {
this._pendingFileTransfers.delete(fileIdent);
}
}
Expand All @@ -305,7 +305,7 @@ export class AttachmentFileManager implements IAttachmentFileManager {
}

const fileInfoNoData = await this._docStorage.getFileInfo(fileIdent, false);
const fileExists = fileInfoNoData != null;
const fileExists = fileInfoNoData !== null;

if (fileExists) {
const isFileInTargetStore = isExternal ?
Expand Down

0 comments on commit ca0ee2d

Please sign in to comment.