mirror of
https://github.com/distribution/distribution
synced 2024-11-06 19:35:52 +01:00
StorageDriver: GCS: allow Cancel on a closed FileWriter
Signed-off-by: Arthur Baars <arthur@semmle.com>
This commit is contained in:
parent
0490ff450b
commit
eca581cf36
@ -321,12 +321,8 @@ type writer struct {
|
|||||||
|
|
||||||
// Cancel removes any written content from this FileWriter.
|
// Cancel removes any written content from this FileWriter.
|
||||||
func (w *writer) Cancel() error {
|
func (w *writer) Cancel() error {
|
||||||
err := w.checkClosed()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
w.closed = true
|
w.closed = true
|
||||||
err = storageDeleteObject(cloud.NewContext(dummyProjectID, w.client), w.bucket, w.name)
|
err := storageDeleteObject(cloud.NewContext(dummyProjectID, w.client), w.bucket, w.name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if status, ok := err.(*googleapi.Error); ok {
|
if status, ok := err.(*googleapi.Error); ok {
|
||||||
if status.Code == http.StatusNotFound {
|
if status.Code == http.StatusNotFound {
|
||||||
|
Loading…
Reference in New Issue
Block a user