Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -69,6 +70,7 @@ export class FileSelectDestinationComponent implements OnInit {
getRootFolders: GetMoveDialogRootFolders,
getConfiguredStorageAddons: GetMoveDialogConfiguredStorageAddons,
getStorageSupportedFeatures: GetStorageSupportedFeatures,
setCurrentProvider: SetCurrentProvider,
});

readonly osfStorageLabel = 'OSF Storage';
Expand Down Expand Up @@ -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);
}
}
}

Expand Down
Loading