Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid character issue "&#x1b" in AmazonS3Client::listMultipartUploads #3112

Closed
1 task done
navinyashende opened this issue May 20, 2024 · 5 comments
Closed
1 task done
Labels
closed-for-staleness guidance Question that needs advice or information.

Comments

@navinyashende
Copy link

Upcoming End-of-Support

  • I acknowledge the upcoming end-of-support for AWS SDK for Java v1 was announced, and migration to AWS SDK for Java v2 is recommended.

Describe the bug

Getting error while running listMultipartUpload method
Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 599; Character reference "&#x1b" is an invalid XML character.

Expected Behavior

XML Response should be parsed without any issues. "&#x1b" is not a recommended escape character in xml.

Current Behavior

Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 599; Character reference "&#x1b" is an invalid XML character.

Reproduction Steps

Initialize s3 client and call listMultipartUploads

Possible Solution

Remove invalid character from XML response.

Additional Information/Context

No response

AWS Java SDK version used

1.12.725

JDK version used

openjdk version "1.8.0_402" OpenJDK Runtime Environment (build 1.8.0_402-b05) OpenJDK 64-Bit Server VM (build 25.402-b05, mixed mode)

Operating System and version

Fedora 40

@navinyashende navinyashende added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 20, 2024
@debora-ito
Copy link
Member

@navinyashende use enconding-type:url in the ListMultipartUploads and see if it works.

        ListMultipartUploadsRequest request = ListMultipartUploadsRequest.builder()
                .bucket(BUCKET)
                .prefix(PREFIX)
                .encodingType(EncodingType.URL)
                .build();

@debora-ito debora-ito added guidance Question that needs advice or information. closing-soon This issue will close in 2 days unless further comments are made. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 20, 2024
@navinyashende
Copy link
Author

navinyashende commented May 21, 2024

@debora-ito We are using abortMultipartUploads method in TransferManager which internally calls listMultipartUploads in the AmazonS3.

@github-actions github-actions bot removed the closing-soon This issue will close in 2 days unless further comments are made. label May 21, 2024
@debora-ito
Copy link
Member

I see. In this case, have you tried to manually url-encode the request attributes (like bucket and object name) before uploading? How the multipart upload is being done in the first place, is via TransferManager.upload()? Asking because I believe the SDK would encode bucket and object names in the upload.

@debora-ito debora-ito added the response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days. label May 21, 2024
@navinyashende
Copy link
Author

@debora-ito The uploads are done from UI application via https://aws.amazon.com/sdk-for-javascript/. I was thinking if it would be possible to add encodingType in TransferManager class while making ListMultipartUploads request. This would make SDK immune to such issues.
https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/TransferManager.java#L1994

@github-actions github-actions bot removed the response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days. label May 22, 2024
@debora-ito
Copy link
Member

It would be nice but Java SDK v1 work is not being prioritized right now, ahead of the upcoming Maintenance Mode.

The workaround here is to manually encode the upload request attributes.

@debora-ito debora-ito added the closing-soon This issue will close in 2 days unless further comments are made. label May 23, 2024
@github-actions github-actions bot added closed-for-staleness and removed closing-soon This issue will close in 2 days unless further comments are made. labels May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

2 participants