[#30] add object name resolving

Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
Pavel Pogodaev 2023-05-05 11:19:35 +03:00
parent 37dbb29535
commit 8c3c3782f5
17 changed files with 507 additions and 42 deletions

View file

@ -121,9 +121,17 @@ func idsToResponse(resp *fasthttp.Response, obj *object.Object) {
resp.Header.Set(hdrContainerID, cnrID.String())
}
// HeadByAddress handles head requests using simple cid/oid format.
func (d *Downloader) HeadByAddress(c *fasthttp.RequestCtx) {
d.byAddress(c, headObject)
// HeadByAddressOrBucketName handles head requests using simple cid/oid or bucketname/key format.
func (d *Downloader) HeadByAddressOrBucketName(c *fasthttp.RequestCtx) {
test, _ := c.UserValue("oid").(string)
var id oid.ID
err := id.DecodeString(test)
if err != nil {
d.byBucketname(c, headObject)
} else {
d.byAddress(c, headObject)
}
}
// HeadByAttribute handles attribute-based head requests.