From c20a97e279029b6ead910c3c0fef78d3dbae35c1 Mon Sep 17 00:00:00 2001 From: Anton SHEPILOV Date: Wed, 4 Dec 2024 17:34:36 +0100 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=94=A8=20Removed=20changes=20check=20?= =?UTF-8?q?for=20feature=20branch=20publishing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish_feature.yml | 36 +++++---------------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/.github/workflows/publish_feature.yml b/.github/workflows/publish_feature.yml index 629d2cd1..3b02542b 100644 --- a/.github/workflows/publish_feature.yml +++ b/.github/workflows/publish_feature.yml @@ -8,41 +8,17 @@ on: - release/* jobs: - setup: - name: Setup jobs - runs-on: ubuntu-latest - outputs: - targets: ${{ steps.filter.outputs.changes }} - steps: - - uses: actions/checkout@v4 - - uses: dorny/paths-filter@v3 - id: filter - with: - filters: | - backend: - - "tdrive/backend/node/**" - - "tdrive/docker/tdrive-node/Dockerfile" - frontend: - - "tdrive/frontend/**" - - "tdrive/docker/tdrive-frontend/**" - onlyoffice-connector: - - "tdrive/connectors/onlyoffice-connector/**" - - "tdrive/docker/onlyoffice-connector/Dockerfile" - ldap-sync: - - "tdrive/backend/utils/ldap-sync/**" - - "tdrive/docker/tdrive-ldap-sync/Dockerfile" - nextcloud-migration: - - "tdrive/backend/utils/nextcloud-migration/**" - - "tdrive/docker/tdrive-nextcloud-migration/Dockerfile" - publish-feature: runs-on: ubuntu-latest strategy: matrix: - targets: ${{ fromJSON(needs.setup.outputs.targets) }} + targets: + - backend + - frontend + - onlyoffice-connector + - ldap-sync + - nextcloud-migration fail-fast: false - needs: - - setup steps: - name: Checkout uses: actions/checkout@v4 From 93750c5afc6912a1e53f6c9910f07459d4580780 Mon Sep 17 00:00:00 2001 From: Anton SHEPILOV Date: Thu, 12 Dec 2024 20:47:47 +0100 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=90=9BThrow=20exception=20in=20error?= =?UTF-8?q?=20during=20exists=20method=20in=20storage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/storage/oneof-storage-strategy.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts b/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts index b71c7026..5d0a8569 100644 --- a/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts +++ b/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts @@ -125,8 +125,16 @@ export class OneOfStorageStrategy implements StorageConnectorAPI { */ exists = async (path: string, options?: ReadOptions): Promise => { for (const storage of this.storages) { - if (await storage.exists(path, options)) { - return true; + try { + if (await storage.exists(path, options)) { + return true; + } + } catch (e) { + throw new OneOfStorageReadOneFailedException( + storage.getId(), + `Reading ${path} from storage ${storage} failed.`, + e, + ); } } return false; From 0025964b6888cc91da6c417253caa5622e494bdd Mon Sep 17 00:00:00 2001 From: Anton SHEPILOV Date: Thu, 19 Dec 2024 18:33:43 +0100 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=90=9BThrow=20write=20exception=20wit?= =?UTF-8?q?h=20proper=20storage=20identifier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/oneof-storage-strategy.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts b/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts index 5d0a8569..e366bedd 100644 --- a/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts +++ b/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts @@ -70,18 +70,21 @@ export class OneOfStorageStrategy implements StorageConnectorAPI { ); // Log all errors and throw if all write operations fail - const errors = writeResults.filter(result => result.status === "rejected"); - errors.forEach((error, index) => { - const storageId = this.storages[index].getId(); - logger.error( - new OneOfStorageWriteOneFailedException( - storageId, - `Error writing to storage ${storageId}`, - (error as PromiseRejectedResult).reason, - ), - ); + let errorsCount = 0; + writeResults.forEach((result, index) => { + if (result.status === "rejected") { + const storageId = this.storages[index].getId(); + logger.error( + new OneOfStorageWriteOneFailedException( + storageId, + `Error writing to storage ${storageId}`, + (result as PromiseRejectedResult).reason, + ), + ); + errorsCount++; + } }); - if (errors.length === this.storages.length) { + if (errorsCount === this.storages.length) { throw new WriteFileException(`Write ${path} failed for all storages`); } From c82787bc1780d4b23c19380a5c52bc91a99a235a Mon Sep 17 00:00:00 2001 From: Anton SHEPILOV Date: Thu, 19 Dec 2024 19:02:27 +0100 Subject: [PATCH 4/6] =?UTF-8?q?=E2=99=BB=EF=B8=8FAdded=20file=20path=20to?= =?UTF-8?q?=20all=20storage=20exceptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/core/platform/services/storage/exceptions.ts | 12 ++++++++++-- .../services/storage/oneof-storage-strategy.ts | 9 ++++++--- .../platform/services/storage/storage-service.ts | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tdrive/backend/node/src/core/platform/services/storage/exceptions.ts b/tdrive/backend/node/src/core/platform/services/storage/exceptions.ts index f4fb0f7b..72d59c8d 100644 --- a/tdrive/backend/node/src/core/platform/services/storage/exceptions.ts +++ b/tdrive/backend/node/src/core/platform/services/storage/exceptions.ts @@ -1,2 +1,10 @@ -export class FileNotFountException extends Error {} -export class WriteFileException extends Error {} +export class FileNotFountException extends Error { + constructor(readonly path: string, details: string) { + super(details); + } +} +export class WriteFileException extends Error { + constructor(readonly path: string, details: string) { + super(details); + } +} diff --git a/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts b/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts index e366bedd..0e44b3a8 100644 --- a/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts +++ b/tdrive/backend/node/src/core/platform/services/storage/oneof-storage-strategy.ts @@ -77,6 +77,7 @@ export class OneOfStorageStrategy implements StorageConnectorAPI { logger.error( new OneOfStorageWriteOneFailedException( storageId, + path, `Error writing to storage ${storageId}`, (result as PromiseRejectedResult).reason, ), @@ -85,7 +86,7 @@ export class OneOfStorageStrategy implements StorageConnectorAPI { } }); if (errorsCount === this.storages.length) { - throw new WriteFileException(`Write ${path} failed for all storages`); + throw new WriteFileException(path, `Write ${path} failed for all storages`); } const successResult = writeResults.filter( @@ -111,13 +112,14 @@ export class OneOfStorageStrategy implements StorageConnectorAPI { logger.error( new OneOfStorageReadOneFailedException( storage.getId(), + path, `Reading ${path} from storage ${storage} failed.`, err, ), ); } } - throw new FileNotFountException(`Error reading ${path}`); + throw new FileNotFountException(path, `Error reading ${path}`); }; /** @@ -135,6 +137,7 @@ export class OneOfStorageStrategy implements StorageConnectorAPI { } catch (e) { throw new OneOfStorageReadOneFailedException( storage.getId(), + path, `Reading ${path} from storage ${storage} failed.`, e, ); @@ -159,7 +162,7 @@ export class OneOfStorageStrategy implements StorageConnectorAPI { * Throw when read from one of the storages is filed. */ class StorageException extends Error { - constructor(readonly storageId: string, details: string, error: Error) { + constructor(readonly storageId: string, readonly path: string, details: string, error: Error) { super(details, error); } } diff --git a/tdrive/backend/node/src/core/platform/services/storage/storage-service.ts b/tdrive/backend/node/src/core/platform/services/storage/storage-service.ts index 4eaea4ba..b57d1807 100644 --- a/tdrive/backend/node/src/core/platform/services/storage/storage-service.ts +++ b/tdrive/backend/node/src/core/platform/services/storage/storage-service.ts @@ -104,7 +104,7 @@ export default class StorageService extends TdriveService implements async read(path: string, options?: ReadOptions): Promise { if (!(await this.exists(path, options))) { - throw new FileNotFountException(); + throw new FileNotFountException(path, "File doesn't exist"); } try { // eslint-disable-next-line @typescript-eslint/no-this-alias From 84a61c1431c4b142cea589aa5aa80dc48115a83e Mon Sep 17 00:00:00 2001 From: Anton SHEPILOV Date: Wed, 8 Jan 2025 11:16:51 +0100 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=90=9Bdo=20not=20generate=20thumbnail?= =?UTF-8?q?s=20tmp=20until=20it=20will=20be=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/node/src/services/files/web/controllers/files.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tdrive/backend/node/src/services/files/web/controllers/files.ts b/tdrive/backend/node/src/services/files/web/controllers/files.ts index 0bb0801f..e3570bcf 100644 --- a/tdrive/backend/node/src/services/files/web/controllers/files.ts +++ b/tdrive/backend/node/src/services/files/web/controllers/files.ts @@ -29,8 +29,8 @@ export class FileController { chunkNumber: parseInt(q.resumableChunkNumber || q.chunk_number) || 1, filename: q.resumableFilename || q.filename || file?.filename || undefined, type: q.resumableType || q.type || file?.mimetype || undefined, - waitForThumbnail: q.thumbnail_sync, - ignoreThumbnails: q.ignore_thumbnails, + waitForThumbnail: false, + ignoreThumbnails: true, }; const id = request.params.id; From ab4c39e22a387b2c819453f678467801abe6ebcf Mon Sep 17 00:00:00 2001 From: Anton SHEPILOV Date: Wed, 8 Jan 2025 15:46:31 +0100 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=90=9Bdo=20not=20generate=20thumbnail?= =?UTF-8?q?s=20tmp=20until=20it=20will=20be=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tdrive/backend/node/src/services/documents/services/index.ts | 2 +- tdrive/backend/node/src/services/documents/utils.ts | 2 +- .../node/src/services/documents/web/controllers/documents.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tdrive/backend/node/src/services/documents/services/index.ts b/tdrive/backend/node/src/services/documents/services/index.ts index 8f3b840d..cc048c6f 100644 --- a/tdrive/backend/node/src/services/documents/services/index.ts +++ b/tdrive/backend/node/src/services/documents/services/index.ts @@ -403,7 +403,7 @@ export class DocumentsService { company_id: driveItem.company_id, }, context, - { waitForThumbnail: true }, + { waitForThumbnail: false }, ); } diff --git a/tdrive/backend/node/src/services/documents/utils.ts b/tdrive/backend/node/src/services/documents/utils.ts index a503e9ef..c55dec7e 100644 --- a/tdrive/backend/node/src/services/documents/utils.ts +++ b/tdrive/backend/node/src/services/documents/utils.ts @@ -475,7 +475,7 @@ export const getFileMetadata = async ( company_id: context.company.id, }, context, - { ...(context.user?.server_request ? {} : { waitForThumbnail: true }) }, + { ...(context.user?.server_request ? {} : { waitForThumbnail: false }) }, ); if (!file) { diff --git a/tdrive/backend/node/src/services/documents/web/controllers/documents.ts b/tdrive/backend/node/src/services/documents/web/controllers/documents.ts index 348971fa..9d9b93b4 100644 --- a/tdrive/backend/node/src/services/documents/web/controllers/documents.ts +++ b/tdrive/backend/node/src/services/documents/web/controllers/documents.ts @@ -63,8 +63,8 @@ export class DocumentsController { chunkNumber: parseInt(q.resumableChunkNumber || q.chunk_number) || 1, filename: q.resumableFilename || q.filename || file?.filename || undefined, type: q.resumableType || q.type || file?.mimetype || undefined, - waitForThumbnail: !!q.thumbnail_sync, - ignoreThumbnails: false, + waitForThumbnail: false, + ignoreThumbnails: true, }; createdFile = await globalResolver.services.files.save(null, file, options, context);