fix headers

This commit is contained in:
2026-02-02 13:31:48 +02:00
parent fa8563848f
commit 8e9c270972
3 changed files with 21 additions and 20 deletions
+9 -8
View File
@@ -21,8 +21,9 @@ func (hand *Handler) FileExists(rctx *router.Context) {
rctx.SetStatus(code)
return
}
// TODO
rctx.SetHeader("X-Content-Type", res.ContentType)
rctx.SetHeader("X-Content-Size", res.ContentSize)
rctx.SetHeader("X-Content-Length", res.ContentLength)
rctx.SetHeader("X-Content-Digest", res.ContentDigest)
rctx.SetHeader("Content-Length", "0")
rctx.SetStatus(code)
@@ -31,17 +32,17 @@ func (hand *Handler) FileExists(rctx *router.Context) {
func (hand *Handler) PutFile(rctx *router.Context) {
hand.logg.Debugf("Handle PutFile")
contentSize := rctx.GetHeader("Content-Size")
contentLength := rctx.GetHeader("Content-Length")
contentType := rctx.GetHeader("Content-Type")
filepath := rctx.PathMap["filepath"]
hand.logg.Debugf("%s", contentSize)
hand.logg.Debugf("Content-Length=%s", rctx.GetHeader("Content-Length"))
params := &operator.PutFileParams{
Filepath: filepath,
ContentSize: contentSize,
ContentType: contentType,
Source: rctx.Request.Body,
Filepath: filepath,
ContentLength: contentLength,
ContentType: contentType,
Source: rctx.Request.Body,
}
code, _, err := hand.oper.PutFile(params)
if err != nil {
@@ -69,7 +70,7 @@ func (hand *Handler) GetFile(rctx *router.Context) {
}
rctx.SetHeader("Content-Type", res.ContentType)
rctx.SetHeader("Content-Length", res.ContentSize)
rctx.SetHeader("Content-Length", res.ContentLength)
rctx.SetHeader("Content-Digest", res.ContentDigest)
rctx.SetStatus(code)