Skip to content

Commit

Permalink
Fixed file renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Clon1998 committed Sep 5, 2023
1 parent 1f1b78e commit a4a6e99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ui/screens/files/files_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,10 @@ class FilesPageController extends _$FilesPageController {
);

if (dialogResponse?.confirmed == true) {
state = state.copyWith(files: state.files.toLoading());
String newName = dialogResponse!.data;
if (file.fileExtension != null) newName = '$newName.${file.fileExtension!}';
if (newName == file.name) return;
state = state.copyWith(files: state.files.toLoading());

try {
await _fileService.moveFile('${state.pathAsString}/${file.name}', '${state.pathAsString}/$newName');
Expand Down

0 comments on commit a4a6e99

Please sign in to comment.