Skip to content

Commit 9e0e1c6

Browse files
Rash419alperozturk96
authored andcommitted
fix(richdocuments): Use filename from DownloadAs postmessage for correct file extension
Signed-off-by: Rashesh Padia <rashesh.padia@collabora.com>
1 parent c7ff339 commit 9e0e1c6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,13 @@ class RichDocumentsEditorWebView : EditorWebView() {
169169
val url = downloadJson.getString(URL).toUri()
170170
when (downloadJson.getString(TYPE)) {
171171
PRINT -> printFile(url)
172+
172173
SLIDESHOW -> showSlideShow(url)
173-
else -> downloadFile(url, fileName)
174+
175+
else -> {
176+
val downloadFileName = downloadJson.optString(FILENAME, fileName)
177+
downloadFile(url, downloadFileName)
178+
}
174179
}
175180
} catch (e: JSONException) {
176181
Log_OC.e(this, "Failed to parse download json message: $e")
@@ -219,5 +224,6 @@ class RichDocumentsEditorWebView : EditorWebView() {
219224
private const val PRINT = "print"
220225
private const val SLIDESHOW = "slideshow"
221226
private const val NEW_NAME = "NewName"
227+
private const val FILENAME = "filename"
222228
}
223229
}

0 commit comments

Comments
 (0)