mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-20 07:37:15 +00:00
commit
a56cd3dddd
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
## 0.8.9
|
||||
|
||||
* `Ktor`:
|
||||
* `Server`:
|
||||
* Fixes in `uniloadMultipart`
|
||||
* `Client`:
|
||||
* Fixes in `unimultipart`
|
||||
* `FSM`:
|
||||
* Fixes in `DefaultUpdatableStatesMachine`
|
||||
|
||||
## 0.8.8
|
||||
|
||||
* `Versions`:
|
||||
|
@ -28,12 +28,12 @@ open class DefaultUpdatableStatesMachine<T : State>(
|
||||
|
||||
override suspend fun performStateUpdate(previousState: Optional<T>, actualState: T, scope: CoroutineScope) {
|
||||
statesJobsMutex.withLock {
|
||||
if (previousState.dataOrNull() != actualState) {
|
||||
if (compare(previousState, actualState)) {
|
||||
statesJobs[actualState] ?.cancel()
|
||||
}
|
||||
val job = previousState.mapOnPresented {
|
||||
statesJobs.remove(it)
|
||||
} ?: scope.launch {
|
||||
} ?.takeIf { it.isActive } ?: scope.launch {
|
||||
performUpdate(actualState)
|
||||
}.also { job ->
|
||||
job.invokeOnCompletion { _ ->
|
||||
@ -52,6 +52,8 @@ open class DefaultUpdatableStatesMachine<T : State>(
|
||||
}
|
||||
}
|
||||
|
||||
protected open suspend fun compare(previous: Optional<T>, new: T): Boolean = previous.dataOrNull() != new
|
||||
|
||||
override suspend fun updateChain(currentState: T, newState: T) {
|
||||
statesManager.update(currentState, newState)
|
||||
}
|
||||
|
@ -45,5 +45,5 @@ dokka_version=1.5.31
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.8.8
|
||||
android_code_version=88
|
||||
version=0.8.9
|
||||
android_code_version=89
|
||||
|
@ -140,7 +140,7 @@ suspend fun <ResultType> HttpClient.unimultipart(
|
||||
inputProvider,
|
||||
Headers.build {
|
||||
append(HttpHeaders.ContentType, mimetype)
|
||||
append(HttpHeaders.ContentDisposition, "filename=$filename")
|
||||
append(HttpHeaders.ContentDisposition, "filename=\"$filename\"")
|
||||
dataHeadersBuilder()
|
||||
}
|
||||
)
|
||||
|
@ -180,7 +180,13 @@ suspend fun <T> ApplicationCall.uniloadMultipartFile(
|
||||
"bytes" -> {
|
||||
val name = FileName(it.originalFileName ?: error("File name is unknown for default part"))
|
||||
resultInput = MPPFile.createTempFile(
|
||||
name.nameWithoutExtension,
|
||||
name.nameWithoutExtension.let {
|
||||
var resultName = it
|
||||
while (resultName.length < 3) {
|
||||
resultName += "_"
|
||||
}
|
||||
resultName
|
||||
},
|
||||
".${name.extension}"
|
||||
).apply {
|
||||
outputStream().use { fileStream ->
|
||||
@ -216,7 +222,13 @@ suspend fun ApplicationCall.uniloadMultipartFile(
|
||||
if (it.name == "bytes") {
|
||||
val name = FileName(it.originalFileName ?: error("File name is unknown for default part"))
|
||||
resultInput = MPPFile.createTempFile(
|
||||
name.nameWithoutExtension,
|
||||
name.nameWithoutExtension.let {
|
||||
var resultName = it
|
||||
while (resultName.length < 3) {
|
||||
resultName += "_"
|
||||
}
|
||||
resultName
|
||||
},
|
||||
".${name.extension}"
|
||||
).apply {
|
||||
outputStream().use { fileStream ->
|
||||
|
Loading…
Reference in New Issue
Block a user