Skip to content

Commit edec670

Browse files
authored
Merge pull request #11384 from nextcloud/fix/invalid-filename-download
Improve error message when download fails due to invalid filename
2 parents 0f9226c + 7fd58b7 commit edec670

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

app/src/main/java/com/owncloud/android/utils/ErrorMessageAdapter.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,13 @@ String getMessageForDownloadFileOperation(
324324
new File(operation.getSavePath()).getName());
325325

326326
} else {
327-
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
328-
return res.getString(R.string.downloader_download_file_not_found);
329-
327+
switch (result.getCode()) {
328+
case FILE_NOT_FOUND:
329+
return res.getString(R.string.downloader_download_file_not_found);
330+
case CANNOT_CREATE_FILE:
331+
return res.getString(R.string.download_cannot_create_file);
332+
case INVALID_LOCAL_FILE_NAME:
333+
return res.getString(R.string.download_download_invalid_local_file_name);
330334
}
331335
}
332336
return null;

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,4 +1075,6 @@
10751075
<string name="document_scan_export_dialog_title">Choose export type</string>
10761076
<string name="document_scan_export_dialog_pdf">PDF file</string>
10771077
<string name="document_scan_export_dialog_images">Multiple images</string>
1078+
<string name="download_cannot_create_file">Cannot create local file</string>
1079+
<string name="download_download_invalid_local_file_name">Invalid filename for local file</string>
10781080
</resources>

0 commit comments

Comments
 (0)