mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-03 09:09:47 +01:00
Merge pull request #8438 from wy65701436/fix-quota-bug
Fix logic error in quota middlewware on handling failure response
This commit is contained in:
commit
ca20281b35
@ -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