Skip to content

s3s may not be configured with MIME defaults #361

@loverustfs

Description

@loverustfs

Bug tips

[2025-10-14 20:19:46.939081 +08:00] ERROR [s3s::ops] [/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/s3s-0.12.0-rc.2/src/ops/mod.rs:254] [rustfs-worker:ThreadId(16)] error=S3Error { code: InvalidRequest, message: "invalid content type", source: FromStrError { inner: MissingSlash }, .. }

Image

Possible causes

MinIO may have a default value when uploading in C++ without providing a MIME type, but s3s may not have one.

Partial code


Aws::Client::ClientConfiguration config("xxxx", true); 
    config.endpointOverride = ossConfig.endpoint.toStdString();
    config.verifySSL = false;
    // config.connectTimeoutMs = 5000;
    // config.requestTimeoutMs = 5000;
    // config.httpRequestTimeoutMs = 5000;
    config.scheme = Aws::Http::Scheme::HTTP; // Assuming MinIO is using HTTP
    config.region = Aws::Region::CN_NORTH_1; // Region does not matter for MinIO, but needs to be set

    auto s3Client = CreateS3ClientForMinIOV2(ossConfig);
    auto end = std::chrono::high_resolution_clock::now();
    qInfo() << "[UploadFileV2] CreateS3ClientForMinIO waste:" << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << " ms";
    
    auto sdk_client_executor = Aws::MakeShared<Aws::Utils::Threading::PooledThreadExecutor>(UPLOAD_TAG, THREAD_POOL_SIZE);
    //auto sdk_client_executor = Aws::MakeShared<Aws::Utils::Threading::DefaultExecutor>(UPLOAD_TAG);
    Aws::Transfer::TransferManagerConfiguration transferConfig(sdk_client_executor.get());
    transferConfig.s3Client = s3Client;

    transferConfig.uploadProgressCallback = [=](const Aws::Transfer::TransferManager*,
        const std::shared_ptr<const Aws::Transfer::TransferHandle>& handle) {
            //qInfo() << "[UploadFileV2] Upload Progress: " << handle->GetBytesTransferred()
            //    << " of " << handle->GetBytesTotalSize() << " bytes" << " OK PARTS:" << handle->GetCompletedParts().size();
    };
    transferConfig.bufferSize = PART_SIZE;// Aws::Transfer::MB5;

    // TransferManager
    auto transferManager = Aws::Transfer::TransferManager::Create(transferConfig);

    // Upload object
    auto uploadHandle = transferManager->UploadFile(filePath.toStdString(), realBucketName, objectKey, "", Aws::Map<Aws::String, Aws::String>());

Success code

source.gz

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions