Skip to content

Commit 2068f01

Browse files
handle multipart_file_size value is empty
1 parent 1ceb445 commit 2068f01

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

internal/wrappers/uploads-http.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,10 @@ func getPartSizeBytes() (int64, error) {
422422
// Get part size in GB from config if config is not provided, default to 2 GB
423423
partChunkSizeStr := viper.GetString(commonParams.MultipartFileSize)
424424
partChunkSizeFloat, err := strconv.ParseFloat(partChunkSizeStr, 64)
425+
// If parsing fails or value is empty, default to 2 GB
425426
if err != nil {
426-
return 0, fmt.Errorf("invalid part size value: %w", err)
427+
logger.PrintIfVerbose(fmt.Sprintf("Configured part size '%s' is invalid or empty. Defaulting to 2 GB.", partChunkSizeStr))
428+
partChunkSizeFloat = 2
427429
}
428430
// Truncate to integer
429431
truncatedSize := int64(partChunkSizeFloat)

test/integration/scan_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2743,5 +2743,5 @@ func TestCreateScan_AsMultipartUpload_Success(t *testing.T) {
27432743
err, _ := executeCommand(t, args...)
27442744
assert.NilError(t, err)
27452745
log.SetOutput(os.Stderr)
2746-
assert.Assert(t, strings.Contains(buf.String(), "File size >5GB and INCREASE_FILE_UPLOAD_LIMIT flag is enabled,hence uploading file in multiple parts"), "uploading file in multiple parts")
2746+
assert.Assert(t, strings.Contains(buf.String(), "File size >5GB and INCREASE_FILE_UPLOAD_LIMIT flag is enabled,hence uploading file in multiple parts"), "Test for uploading file in multiple parts failed.")
27472747
}

0 commit comments

Comments
 (0)