working commit
This commit is contained in:
+7
-4
@@ -18,22 +18,25 @@ import (
|
||||
|
||||
const zeroContentLength = "0"
|
||||
|
||||
func (hand *Handler) FileExists(rctx *router.Context) {
|
||||
func (hand *Handler) FileInfo(rctx *router.Context) {
|
||||
|
||||
filepath, _ := rctx.GetSubpath("filepath")
|
||||
params := &operator.FileExistsParams{
|
||||
params := &operator.FileInfoParams{
|
||||
Filepath: filepath,
|
||||
}
|
||||
ctx := rctx.GetContext()
|
||||
code, res, err := hand.oper.FileExists(ctx, params)
|
||||
code, res, err := hand.oper.FileInfo(ctx, params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("FileExists error: %v", err)
|
||||
hand.logg.Errorf("FileInfo error: %v", err)
|
||||
rctx.SetStatus(code)
|
||||
return
|
||||
}
|
||||
rctx.SetHeader("Content-Collection", res.ContentCollection)
|
||||
rctx.SetHeader("Content-Name", res.ContentName)
|
||||
rctx.SetHeader("Content-Type", res.ContentType)
|
||||
rctx.SetHeader("Content-Size", res.ContentSize)
|
||||
rctx.SetHeader("Content-Digest", res.ContentDigest)
|
||||
|
||||
rctx.SetHeader("Content-Length", zeroContentLength)
|
||||
rctx.SetStatus(code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user