Skip to content

Commit c090c13

Browse files
committed
fix(richdocuments): Use filename from DownloadAs postmessage for correct file extension
Signed-off-by: Rashesh Padia <rashesh.padia@collabora.com>
1 parent 8d40e96 commit c090c13

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/src/main/java/com/owncloud/android/ui/activity/RichDocumentsEditorWebView.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ class RichDocumentsEditorWebView : EditorWebView() {
170170
when (downloadJson.getString(TYPE)) {
171171
PRINT -> printFile(url)
172172
SLIDESHOW -> showSlideShow(url)
173-
else -> downloadFile(url, fileName)
173+
else -> {
174+
val downloadFileName = downloadJson.optString(FILENAME, fileName)
175+
downloadFile(url, downloadFileName)
176+
}
174177
}
175178
} catch (e: JSONException) {
176179
Log_OC.e(this, "Failed to parse download json message: $e")
@@ -219,5 +222,6 @@ class RichDocumentsEditorWebView : EditorWebView() {
219222
private const val PRINT = "print"
220223
private const val SLIDESHOW = "slideshow"
221224
private const val NEW_NAME = "NewName"
225+
private const val FILENAME = "filename"
222226
}
223227
}

0 commit comments

Comments
 (0)