Skip to content

Commit

Permalink
feat: 修复空文件下载bug TencentBlueKing#1843
Browse files Browse the repository at this point in the history
  • Loading branch information
felixncheng authored Mar 7, 2024
1 parent 09bb2dd commit 519e540
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ abstract class AbstractArtifactResourceHandler(
* @param totalSize 数据总大小
*/
protected fun getBufferSize(totalSize: Long): Int {
if (totalSize == 0L) {
// buffer size 不能为0,否则会导致流io空转。
return 1
}
val bufferSize = storageProperties.response.bufferSize.toBytes().toInt()
require(totalSize > 0 && bufferSize > 0)
return totalSize.coerceAtMost(bufferSize.toLong()).toInt()
Expand Down

0 comments on commit 519e540

Please sign in to comment.