Merge pull request #11155 from osmandapp/fix_10988

Fix_10988
This commit is contained in:
vshcherb 2021-03-16 09:53:22 +01:00 committed by GitHub
commit 0b2cb9ee6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,7 +131,10 @@ public class RenameFileBottomSheet extends MenuBottomSheetDialogFragment {
File dest; File dest;
int index = file.getName().lastIndexOf('.'); int index = file.getName().lastIndexOf('.');
String ext = index == -1 ? "" : file.getName().substring(index); String ext = index == -1 ? "" : file.getName().substring(index);
String newName = Algorithms.getFileNameWithoutExtension(selectedFileName); String newName = selectedFileName;
if (selectedFileName.endsWith(ext)) {
newName = selectedFileName.substring(0, selectedFileName.lastIndexOf(ext));
}
if (SQLiteTileSource.EXT.equals(ext)) { if (SQLiteTileSource.EXT.equals(ext)) {
dest = renameSQLiteFile(app, file, newName + ext, null); dest = renameSQLiteFile(app, file, newName + ext, null);
} else if (IndexConstants.GPX_FILE_EXT.equals(ext)) { } else if (IndexConstants.GPX_FILE_EXT.equals(ext)) {