Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 18ac27e

Browse files
Merge pull request #3020 from stephenfin/remove-etag-validation
objectstorage: Remove traces of etag validation
2 parents b61b4f4 + ba9bd10 commit 18ac27e

File tree

4 files changed

+1
-38
lines changed

4 files changed

+1
-38
lines changed

openstack/objectstorage/v1/objects/errors.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

openstack/objectstorage/v1/objects/requests.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@ func (opts CreateOpts) ToObjectCreateParams() (io.Reader, map[string]string, str
249249
}
250250

251251
// Create is a function that creates a new object or replaces an existing
252-
// object. If the returned response's ETag header fails to match the local
253-
// checksum, the failed request will automatically be retried up to a maximum
254-
// of 3 times.
252+
// object.
255253
func Create(ctx context.Context, c *gophercloud.ServiceClient, containerName, objectName string, opts CreateOptsBuilder) (r CreateResult) {
256254
url, err := createURL(c, containerName, objectName)
257255
if err != nil {

openstack/objectstorage/v1/objects/results.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,11 @@ func (r *CreateHeader) UnmarshalJSON(b []byte) error {
329329

330330
// CreateResult represents the result of a create operation.
331331
type CreateResult struct {
332-
checksum string
333332
gophercloud.HeaderResult
334333
}
335334

336335
// Extract will return a struct of headers returned from a call to Create.
337336
func (r CreateResult) Extract() (*CreateHeader, error) {
338-
//if r.Header.Get("ETag") != fmt.Sprintf("%x", localChecksum) {
339-
// return nil, ErrWrongChecksum{}
340-
//}
341337
var s CreateHeader
342338
err := r.ExtractInto(&s)
343339
return &s, err

openstack/objectstorage/v1/objects/testing/requests_test.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -330,24 +330,6 @@ func TestCreateObjectWithoutContentType(t *testing.T) {
330330
th.AssertNoErr(t, res.Err)
331331
}
332332

333-
/*
334-
func TestErrorIsRaisedForChecksumMismatch(t *testing.T) {
335-
th.SetupHTTP()
336-
defer th.TeardownHTTP()
337-
338-
th.Mux.HandleFunc("/testContainer/testObject", func(w http.ResponseWriter, r *http.Request) {
339-
w.Header().Set("ETag", "acbd18db4cc2f85cedef654fccc4a4d8")
340-
w.WriteHeader(http.StatusCreated)
341-
})
342-
343-
content := strings.NewReader("The sky was the color of television, tuned to a dead channel.")
344-
res := Create(context.TODO(), fake.ServiceClient(), "testContainer", "testObject", &CreateOpts{Content: content})
345-
346-
err := fmt.Errorf("Local checksum does not match API ETag header")
347-
th.AssertDeepEquals(t, err, res.Err)
348-
}
349-
*/
350-
351333
func TestCopyObject(t *testing.T) {
352334
t.Run("simple", func(t *testing.T) {
353335
th.SetupHTTP()

0 commit comments

Comments
 (0)