diff --git a/src/app/features/files/pages/file-redirect/file-redirect.component.ts b/src/app/features/files/pages/file-redirect/file-redirect.component.ts index dfe42b96b..59ffe020b 100644 --- a/src/app/features/files/pages/file-redirect/file-redirect.component.ts +++ b/src/app/features/files/pages/file-redirect/file-redirect.component.ts @@ -18,10 +18,11 @@ export class FileRedirectComponent { private readonly filesService = inject(FilesService); readonly fileId = this.route.snapshot.paramMap.get('fileId') ?? ''; + readonly provider = this.route.snapshot.paramMap.get('provider') ?? ''; constructor() { if (this.fileId) { this.filesService - .getFileGuid(this.fileId) + .getFileGuid(this.fileId, this.provider) .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe((file) => { this.router.navigate([file.guid]); diff --git a/src/app/shared/components/files-tree/files-tree.component.ts b/src/app/shared/components/files-tree/files-tree.component.ts index 44e4c84b8..013178590 100644 --- a/src/app/shared/components/files-tree/files-tree.component.ts +++ b/src/app/shared/components/files-tree/files-tree.component.ts @@ -205,7 +205,7 @@ export class FilesTreeComponent implements OnDestroy, AfterViewInit { if (file.guid) { this.entryFileClicked.emit(file); } else { - this.filesService.getFileGuid(file.id).subscribe((file) => { + this.filesService.getFileGuid(file.id, file.provider).subscribe((file) => { this.entryFileClicked.emit(file); }); } diff --git a/src/app/shared/services/files.service.ts b/src/app/shared/services/files.service.ts index b7da9c0d5..54d5715be 100644 --- a/src/app/shared/services/files.service.ts +++ b/src/app/shared/services/files.service.ts @@ -185,14 +185,16 @@ export class FilesService { .pipe(map((response) => MapFile(response.data))); } - getFileGuid(id: string): Observable { + getFileGuid(id: string, storageId?: string): Observable { const params = { create_guid: 'true', }; + let url = `${this.apiUrl}/files/${id}/`; + if (storageId) { + url = `${this.apiUrl}/files/${storageId}/${id}/`; + } - return this.jsonApiService - .get(`${this.apiUrl}/files/${id}/`, params) - .pipe(map((response) => MapFile(response.data))); + return this.jsonApiService.get(url, params).pipe(map((response) => MapFile(response.data))); } getFileById(fileGuid: string): Observable {