working commit

This commit is contained in:
2026-02-01 21:03:43 +02:00
parent 9c18f62997
commit 18e2a61c8a
10 changed files with 410 additions and 111 deletions
+26 -7
View File
@@ -22,7 +22,7 @@ func (hand *Handler) FileExists(rctx *router.Context) {
return
}
rctx.SetHeader("Content-Type", res.ContentType)
rctx.SetHeader("Content-Length", res.ContentLength)
rctx.SetHeader("Content-Size", res.ContentSize)
rctx.SetHeader("Content-Digest", res.ContentDigest)
rctx.SetStatus(code)
@@ -31,15 +31,17 @@ func (hand *Handler) FileExists(rctx *router.Context) {
func (hand *Handler) PutFile(rctx *router.Context) {
hand.logg.Debugf("Handle PutFile")
contentLength := rctx.GetHeader("Content-Length")
contentSize := rctx.GetHeader("Content-Size")
contentType := rctx.GetHeader("Content-Type")
filepath := rctx.PathMap["filepath"]
hand.logg.Debugf("%s", contentSize)
params := &operator.PutFileParams{
Filepath: filepath,
ContentLength: contentLength,
ContentType: contentType,
Source: rctx.Request.Body,
Filepath: filepath,
ContentSize: contentSize,
ContentType: contentType,
Source: rctx.Request.Body,
}
code, _, err := hand.oper.PutFile(params)
if err != nil {
@@ -67,7 +69,7 @@ func (hand *Handler) GetFile(rctx *router.Context) {
}
rctx.SetStatus(code)
rctx.SetHeader("Content-Type", res.ContentType)
rctx.SetHeader("Content-Length", res.ContentLength)
rctx.SetHeader("Content-Size", res.ContentSize)
rctx.SetHeader("Content-Digest", res.ContentDigest)
if res.Source != nil {
@@ -93,3 +95,20 @@ func (hand *Handler) DeleteFile(rctx *router.Context) {
}
rctx.SetStatus(code)
}
func (hand *Handler) ListFiles(rctx *router.Context) {
hand.logg.Debugf("Handle ListFiles")
filepath := rctx.PathMap["filepath"]
params := &operator.ListFilesParams{
Filepath: filepath,
}
code, res, err := hand.oper.ListFiles(params)
if err != nil {
hand.logg.Errorf("ListFiles error: %v", err)
rctx.SetStatus(code)
return
}
rctx.SetStatus(code)
rctx.SendJSON(res)
}