mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-03 09:09:47 +01:00
Fix logic error in quota middlewware on handling failure response
Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
parent
88f706cff6
commit
1975f4a71d
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user