Skip to content

Commit

Permalink
fix: fs-server stream接口参数解析失败报错 #2812
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoxuwan committed Dec 3, 2024
1 parent aa25852 commit 139afbd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ object ClusterUtils {
throw e
}
} catch (e: RetryableException) {
if (e.message?.contains("Read time out") == true) {
if (e.message?.contains("Read timed out") == true) {
logger.info("ignore feign exception: ${e.message}")
return
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
package com.tencent.bkrepo.fs.server.request

import com.tencent.bkrepo.common.api.exception.ParameterInvalidException
import org.slf4j.LoggerFactory
import org.springframework.web.reactive.function.server.ServerRequest
import org.springframework.web.reactive.function.server.queryParamOrNull

class StreamRequest(val request: ServerRequest) : NodeRequest(request) {
val size = request.queryParamOrNull("size")?.toLong()
?: throw ParameterInvalidException("required size parameter.")
val size = try {
request.queryParamOrNull("size")?.toLong() ?: throw ParameterInvalidException("size")
} catch (e: NumberFormatException) {
logger.info("invalid size parameter: ${request.queryParamOrNull("size")}")
throw ParameterInvalidException("size")
}

val overwrite = request.headers().header("X-BKREPO-OVERWRITE").firstOrNull()?.toBoolean() ?: false
val expires = request.headers().header("X-BKREPO-EXPIRES").firstOrNull()?.toLong() ?: 0

companion object {
private val logger = LoggerFactory.getLogger(StreamRequest::class.java)
}
}

0 comments on commit 139afbd

Please sign in to comment.