1
0
mirror of https://github.com/minio/mc.git synced 2025-07-28 20:01:58 +03:00

rm: Force removing an object when it is encrypted without key specified (#2700)

Currently, a single remove HEAD an object, but this latter can return
400 Bad Request when the object is encrypted and the user doesn't specify
any encryption key.

So when HEAD fail, this PR will use GET listing to find the object and
remove it if existent.

We can avoid calling HEAD in the first place and use only listing, but this
has some penality on the server.
This commit is contained in:
Anis Elleuch
2019-03-12 22:03:59 +01:00
committed by kannappanr
parent e684b48cfe
commit a498b9b3a2
5 changed files with 55 additions and 28 deletions

View File

@ -96,6 +96,13 @@ var errInvalidTarget = func(URL string) *probe.Error {
return probe.NewError(invalidTargetErr(errors.New(msg))).Untrace()
}
type targetNotFoundErr error
var errTargetNotFound = func(URL string) *probe.Error {
msg := "Target `" + URL + "` not found."
return probe.NewError(targetNotFoundErr(errors.New(msg))).Untrace()
}
type overwriteNotAllowedErr struct {
error
}