diff --git a/src/app/features/files/components/move-file-dialog/move-file-dialog.component.ts b/src/app/features/files/components/move-file-dialog/move-file-dialog.component.ts index 52cb9df93..84e90b337 100644 --- a/src/app/features/files/components/move-file-dialog/move-file-dialog.component.ts +++ b/src/app/features/files/components/move-file-dialog/move-file-dialog.component.ts @@ -166,15 +166,13 @@ export class MoveFileDialogComponent { moveFile(): void { const path = this.currentFolder()?.path; - const provider = this.currentFolder()?.provider || this.provider(); - if (!path) { throw new Error(this.translateService.instant('files.dialogs.moveFile.pathError')); } this.isFilesUpdating.set(true); this.filesService - .moveFile(this.config.data.file.links.move, path, this.fileProjectId, provider, this.config.data.action) + .moveFile(this.config.data.file.links.move, path, this.fileProjectId, this.provider(), this.config.data.action) .pipe( takeUntilDestroyed(this.destroyRef), finalize(() => { diff --git a/src/app/shared/components/file-select-destination/file-select-destination.component.ts b/src/app/shared/components/file-select-destination/file-select-destination.component.ts index 81492c7f5..dd68cd1ad 100644 --- a/src/app/shared/components/file-select-destination/file-select-destination.component.ts +++ b/src/app/shared/components/file-select-destination/file-select-destination.component.ts @@ -30,6 +30,7 @@ import { GetMoveDialogConfiguredStorageAddons, GetMoveDialogRootFolders, GetStorageSupportedFeatures, + SetCurrentProvider, SetMoveDialogCurrentFolder, } from '@osf/features/files/store'; import { SupportedFeature } from '@osf/shared/enums/addon-supported-features.enum'; @@ -69,6 +70,7 @@ export class FileSelectDestinationComponent implements OnInit { getRootFolders: GetMoveDialogRootFolders, getConfiguredStorageAddons: GetMoveDialogConfiguredStorageAddons, getStorageSupportedFeatures: GetStorageSupportedFeatures, + setCurrentProvider: SetCurrentProvider, }); readonly osfStorageLabel = 'OSF Storage'; @@ -121,9 +123,12 @@ export class FileSelectDestinationComponent implements OnInit { } onStorageChange(value: Primitive) { - const folder = this.storageAddons().find((option) => option.folder.id === value); - if (folder) { - this.currentRootFolder.set(folder); + const rootFolder = this.storageAddons().find((option) => option.folder.id === value); + if (rootFolder) { + this.currentRootFolder.set(rootFolder); + if (rootFolder.folder.provider) { + this.actions.setCurrentProvider(rootFolder.folder.provider); + } } }