mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 19:08:58 +00:00
5342bec1b7
This is a symmetric change to #9375 -- where that PR changed the protocol->model interface, this changes the model->protocol one.
36 lines
852 B
Go
36 lines
852 B
Go
// Copyright (C) 2014 The Protocol Authors.
|
|
|
|
package protocol
|
|
|
|
import (
|
|
"context"
|
|
"path/filepath"
|
|
|
|
"golang.org/x/text/unicode/norm"
|
|
)
|
|
|
|
type wireFormatConnection struct {
|
|
Connection
|
|
}
|
|
|
|
func (c wireFormatConnection) Index(ctx context.Context, idx *Index) error {
|
|
for i := range idx.Files {
|
|
idx.Files[i].Name = norm.NFC.String(filepath.ToSlash(idx.Files[i].Name))
|
|
}
|
|
|
|
return c.Connection.Index(ctx, idx)
|
|
}
|
|
|
|
func (c wireFormatConnection) IndexUpdate(ctx context.Context, idxUp *IndexUpdate) error {
|
|
for i := range idxUp.Files {
|
|
idxUp.Files[i].Name = norm.NFC.String(filepath.ToSlash(idxUp.Files[i].Name))
|
|
}
|
|
|
|
return c.Connection.IndexUpdate(ctx, idxUp)
|
|
}
|
|
|
|
func (c wireFormatConnection) Request(ctx context.Context, req *Request) ([]byte, error) {
|
|
req.Name = norm.NFC.String(filepath.ToSlash(req.Name))
|
|
return c.Connection.Request(ctx, req)
|
|
}
|