Skip to content

Regression: getPresignedObjectUrl adds empty versionId when null #1692

Description

@Paw565pl

Hello,

I think i have managed to pinpoint a bug in the latest version 9.0.0. There appears to be a regression in getPresignedObjectUrl method in MinioClient class. It looks like a simple invalid (inverted) condition in the source code.

Current code 9.0.0

Http.QueryParameters queryParams = new Http.QueryParameters();
if (args.versionId() == null) queryParams.put("versionId", args.versionId());

Previous version 8.6.0

Multimap<String, String> queryParams = newMultimap(args.extraQueryParams());
if (args.versionId() != null) queryParams.put("versionId", args.versionId());

Impact:

  • When versionId is null or not set, the SDK generates versionId= in query params.
  • When versionId is set, the SDK does not add versionId to query params.
  • This results in malformed presigned URLs.
  • Can lead to signature mismatch errors with S3-compatible backends.

Expected behavior:

  • versionId should only be added if non-null.

Workaround (applicable only if you do not use versionId param):

  • Explicitly set versionId to any non-null value.
minioClient.getPresignedObjectUrl(
  GetPresignedObjectUrlArgs.builder()
  .versionId("dummy")
  // other params
  .build()
)

This seems like a simple regression with potentially broad impact, but it looks like a fix is fairly simple.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions