Fix logic error in quota middlewware on handling failure response

Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
wang yan 2019-07-28 12:37:53 +08:00
parent 88f706cff6
commit 1975f4a71d
2 changed files with 2 additions and 2 deletions

View File

@ -155,7 +155,7 @@ func (pmi *PutManifestInterceptor) HandleResponse(rw util.CustomResponseWriter,
}
}
} else if rw.Status() >= 300 || rw.Status() <= 511 {
} else if rw.Status() >= 300 && rw.Status() <= 511 {
if !mf.Exist {
success := util.TryFreeQuota(mf.ProjectID, mf.Quota)
if !success {

View File

@ -175,7 +175,7 @@ func HandleBlobCommon(rw util.CustomResponseWriter, req *http.Request) error {
if err != nil {
return err
}
} else if rw.Status() >= 300 || rw.Status() <= 511 {
} else if rw.Status() >= 300 && rw.Status() <= 511 {
success := util.TryFreeQuota(bb.ProjectID, bb.Quota)
if !success {
return fmt.Errorf("Error to release resource booked for the blob, %d, digest: %s ", bb.ProjectID, bb.Digest)