diff --git a/android/src/main/java/vn/hunghd/flutterdownloader/DownloadWorker.java b/android/src/main/java/vn/hunghd/flutterdownloader/DownloadWorker.java index 628ca677..acc5fdbe 100644 --- a/android/src/main/java/vn/hunghd/flutterdownloader/DownloadWorker.java +++ b/android/src/main/java/vn/hunghd/flutterdownloader/DownloadWorker.java @@ -403,6 +403,10 @@ private void downloadFile(Context context, String fileURL, String savedDir, Stri outputStream = context.getContentResolver().openOutputStream(uri, "w"); } else { File file = createFileInAppSpecificDir(filename, savedDir); + if (file.getName() != filename) { + filename = file.getName(); + taskDao.updateTask(getId().toString(), filename, contentType); + } savedFilePath = file.getPath(); outputStream = new FileOutputStream(file, false); }