The `filename` magic param isn't always removed from the request
pkosiec opened this issue · comments
Description
The filename
magic parameter sometimes isn't removed from the underlying request, which make some requests fail, e.g. when using signed URLs to GCS bucket.
Details
Based on the code, I believe all the "magic" parameters should be removed before making a request.
This is not the case in case of an URL to tar.gz
directory, like this:
https://storage.googleapis.com/bucket/v1.0.0/binary_darwin_amd64.tar.gz
and configuration:
getterCli := &getter.Client{
Ctx: ctx,
Src: url, // url with `filename` magic param
Dst: tmpDestPath,
Pwd: pwd,
Mode: getter.ClientModeAny,
}
I tracked the code execution, and it falls in the if which changes the mode:
Line 217 in a2ebce9
if decompressor != nil {
// ...
mode = ClientModeFile
}
Which is why the filename
param is not removed, as the next if
is skipped, which actually removes the filename
param.
Lines 230 to 249 in a2ebce9
Fix incoming
I fixed it locally and will prepare a pull request soon. Hope you'll like it!