aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-upload/src/main
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-01-16 18:37:38 +0100
committerRobert Jaros <rjaros@finn.pl>2019-01-16 18:37:38 +0100
commit8f6de1f59e9aa8207e58e43b862c6d252f5341d3 (patch)
tree2702b5cd26550f77a156f89382fa815b1df7151f /kvision-modules/kvision-upload/src/main
parent9f70d8151c4c47c6ae250ec21d579ed3ba7faf14 (diff)
downloadkvision-8f6de1f59e9aa8207e58e43b862c6d252f5341d3.tar.gz
kvision-8f6de1f59e9aa8207e58e43b862c6d252f5341d3.tar.bz2
kvision-8f6de1f59e9aa8207e58e43b862c6d252f5341d3.zip
Fix for UploadInput with empty or multiple value.
Diffstat (limited to 'kvision-modules/kvision-upload/src/main')
-rw-r--r--kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt6
1 files changed, 3 insertions, 3 deletions
diff --git a/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt b/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
index da35f9ef..2af7b3f7 100644
--- a/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
+++ b/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
@@ -254,11 +254,11 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
private fun getFiles(): List<KFile> {
nativeFiles.clear()
- return (getElementJQueryD()?.fileinput("getFileStack") as Array<File>).toList().map {
+ return (getElementJQueryD()?.fileinput("getFileStack") as? Array<File>)?.toList()?.map {
val kFile = KFile(it.name, it.size, null)
nativeFiles[kFile] = it
kFile
- }
+ } ?: listOf()
}
/**
@@ -266,7 +266,7 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
* @return value as a String
*/
fun getValueAsString(): String? {
- return value?.joinToString { it.name }
+ return value?.joinToString(",") { it.name }
}
/**