Обновить internal/endpoint/endpoint.go

This commit is contained in:
2026-07-17 23:06:06 +03:00
parent 8b5a942d39
commit 1358894d5f
+5 -11
View File
@@ -158,17 +158,11 @@ func (s *Sender) ListFilesystems(ctx context.Context, r *pdu.ListFilesystemReq)
return res, nil return res, nil
} }
func (s *Sender) ListFilesystemVersions(ctx context.Context, r *pdu.ListFilesystemVersionsReq) (*pdu.ListFilesystemVersionsRes, error) { func (s *Receiver) ListFilesystemVersions(ctx context.Context, req *pdu.ListFilesystemVersionsReq) (*pdu.ListFilesystemVersionsRes, error) {
defer trace.WithSpanFromStackUpdateCtx(&ctx)() defer trace.WithSpanFromStackUpdateCtx(&ctx)()
// Патч: приводим путь к виду без pool, если пришёл "чистый" путь root := s.clientRootFromCtx(ctx)
fsForFilter := r.GetFilesystem() lp, err := subroot{root}.MapToLocal(req.GetFilesystem())
p, _ := zfs.NewDatasetPath(fsForFilter)
if p.Length() <= 1 && !strings.Contains(fsForFilter, "/") {
// если путь уже короткий — используем фильтр как есть
}
lp, err := s.filterCheckFS(r.GetFilesystem())
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -661,14 +655,14 @@ func (f subroot) MapToLocal(fs string) (*zfs.DatasetPath, error) {
return nil, errors.Errorf("cannot map empty filesystem") return nil, errors.Errorf("cannot map empty filesystem")
} }
// Убираем pool name из source (hdd_...) // Убираем pool из source
if p.Length() > 1 { if p.Length() > 1 {
subpath := p.Copy() subpath := p.Copy()
subpath.TrimNPrefixComps(1) subpath.TrimNPrefixComps(1)
p = subpath p = subpath
} }
// Всегда оставляем только root (chunk_9XG1J8T0) // Оставляем только chunk_9XG1J8T0
c := f.localRoot.Copy() c := f.localRoot.Copy()
if c.Length() > 1 { if c.Length() > 1 {
rootOnly := c.Copy() rootOnly := c.Copy()