Files
kopia/internal/server/api_paths.go
2025-05-29 06:07:49 +00:00

28 lines
719 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) (any, *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
}