forked from TrueCloudLab/distribution
Correctly assemble URL during blob upload
When adding parameters to a location header, the client must not destroy parameters already present. This change ensures that parameters are added, rather than replaced when assembling the url. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
5f863238c0
commit
83977857f8
1 changed files with 6 additions and 7 deletions
|
@ -6,7 +6,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
@ -398,9 +397,9 @@ func (r *clientImpl) UploadBlob(location string, blob io.ReadCloser, length int,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
queryValues := url.Values{}
|
values := putRequest.URL.Query()
|
||||||
queryValues.Set("digest", dgst.String())
|
values.Set("digest", dgst.String())
|
||||||
putRequest.URL.RawQuery = queryValues.Encode()
|
putRequest.URL.RawQuery = values.Encode()
|
||||||
|
|
||||||
putRequest.Header.Set("Content-Type", "application/octet-stream")
|
putRequest.Header.Set("Content-Type", "application/octet-stream")
|
||||||
putRequest.Header.Set("Content-Length", fmt.Sprint(length))
|
putRequest.Header.Set("Content-Length", fmt.Sprint(length))
|
||||||
|
@ -486,9 +485,9 @@ func (r *clientImpl) FinishChunkedBlobUpload(location string, length int, dgst d
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
queryValues := new(url.Values)
|
values := putRequest.URL.Query()
|
||||||
queryValues.Set("digest", dgst.String())
|
values.Set("digest", dgst.String())
|
||||||
putRequest.URL.RawQuery = queryValues.Encode()
|
putRequest.URL.RawQuery = values.Encode()
|
||||||
|
|
||||||
putRequest.Header.Set("Content-Type", "application/octet-stream")
|
putRequest.Header.Set("Content-Type", "application/octet-stream")
|
||||||
putRequest.Header.Set("Content-Length", "0")
|
putRequest.Header.Set("Content-Length", "0")
|
||||||
|
|
Loading…
Reference in a new issue