Files
kopia/internal/server/api_paths.go
Julio Lopez 8098f49c90 chore(ci): remove exclusion for unused ctx parameters (#4530)
Remove unused-parameter exclusion for `ctx` in revive linter.

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-04-26 23:11:36 -07:00

28 lines
727 B
Go

package server
import (
"context"
"encoding/json"
"path/filepath"
"github.com/kopia/kopia/internal/ospath"
"github.com/kopia/kopia/internal/serverapi"
"github.com/kopia/kopia/snapshot"
)
func handlePathResolve(_ context.Context, rc requestContext) (interface{}, *apiError) {
var req serverapi.ResolvePathRequest
if err := json.Unmarshal(rc.body, &req); err != nil {
return nil, requestError(serverapi.ErrorMalformedRequest, "malformed request body")
}
return &serverapi.ResolvePathResponse{
SourceInfo: snapshot.SourceInfo{
Path: filepath.Clean(ospath.ResolveUserFriendlyPath(req.Path, true)),
Host: rc.rep.ClientOptions().Hostname,
UserName: rc.rep.ClientOptions().Username,
},
}, nil
}