Add -O option to mcopy command #550
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #549
This PR adds a new option to the
mcopycommand:-Oor--remote-name- which does the same as the cURL param-O.This basically strips off all the things after a ? or # and takes the last section of the URL to determine the filename, avoiding usage of the HEAD request (which fails on presigned S3 urls, see #549 )
I tested this method with the following URL (expires on May 5th, 2025):
Details
https://nbg1.your-objectstorage.com/ziffer-artifacts-staging/builds/4e8f7980-3955-48c4-9ff9-9a8dbedcbf41/test-plugin-1.0-SNAPSHOT.jar?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=6OL4X4U2SMEH6AKWA71D/20250428/auto/s3/aws4_request&X-Amz-Date=20250428T135531Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=0832406b9351cda79525911df41b7f76166993eb0949e9ab4135cd07c904c64asuccessfully. The
mcopycommand fails if -O is not provided, and succeeds if -O is provided.(Sorry for the formatting changes, I couldn't seem to get VSCode working with the .editorconfig correctly, maybe some other Contributor could format it once with IntelliJ?)