Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,18 @@ object RichDocumentDownloadAsParser {
val format = obj[FORMAT]?.jsonPrimitive?.contentOrNull
val name = obj[NAME]?.jsonPrimitive?.contentOrNull
if (format == null || url == null) return null
return DownloadAs(format = format, filename = name ?: "", url = url)
return DownloadAs(format = format, filename = createFilename(name, format), url = url)
}

private fun tryParseV1(obj: JsonObject, url: String?): DownloadAs? {
val type = obj[TYPE]?.jsonPrimitive?.contentOrNull
val filename = obj[FILENAME]?.jsonPrimitive?.contentOrNull
if (type == null || url == null) return null
return DownloadAs(format = type, filename = filename ?: "", url = url)
return DownloadAs(format = type, filename = createFilename(filename, type), url = url)
}

// TODO: add correct file format
private fun createFilename(filename: String?, format: String?): String {
return filename ?: ("document_${System.currentTimeMillis()}")
}
}
Loading