s3: remove leading slash in CopySource

This commit is contained in:
Girish Ramakrishnan
2025-12-03 17:09:42 +01:00
parent 374e1f65c6
commit b759fdb6e3

View File

@@ -364,12 +364,12 @@ async function listDir(config, remotePath, batchSize, marker) {
// See aws-sdk-js/issues/1302
function encodeCopySource(bucket, path) {
// AWS percent-encodes some extra non-standard characters in a URI
const output = encodeURI(path).replace(/[+!"#$@&'()*+,:;=?@]/g, function(ch) {
const output = encodeURI(path).replace(/[+!"#$@&'()*,:;=?@]/g, function(ch) {
return '%' + ch.charCodeAt(0).toString(16).toUpperCase();
});
// the slash at the beginning is optional
return `/${bucket}/${output}`;
// the slash at the beginning is optional. adding it breaks atleast intercolo.de
return `${bucket}/${output}`;
}
async function copyInternal(config, fullFromPath, fullToPath, fileSize, progressCallback) {