mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
1a5f524ae4
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/2252
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
// Copyright (C) 2014 The Protocol Authors.
|
|
|
|
package protocol
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"golang.org/x/text/unicode/norm"
|
|
)
|
|
|
|
type wireFormatConnection struct {
|
|
Connection
|
|
}
|
|
|
|
func (c wireFormatConnection) Index(folder string, fs []FileInfo, flags uint32, options []Option) error {
|
|
var myFs = make([]FileInfo, len(fs))
|
|
copy(myFs, fs)
|
|
|
|
for i := range fs {
|
|
myFs[i].Name = norm.NFC.String(filepath.ToSlash(myFs[i].Name))
|
|
}
|
|
|
|
return c.Connection.Index(folder, myFs, flags, options)
|
|
}
|
|
|
|
func (c wireFormatConnection) IndexUpdate(folder string, fs []FileInfo, flags uint32, options []Option) error {
|
|
var myFs = make([]FileInfo, len(fs))
|
|
copy(myFs, fs)
|
|
|
|
for i := range fs {
|
|
myFs[i].Name = norm.NFC.String(filepath.ToSlash(myFs[i].Name))
|
|
}
|
|
|
|
return c.Connection.IndexUpdate(folder, myFs, flags, options)
|
|
}
|
|
|
|
func (c wireFormatConnection) Request(folder, name string, offset int64, size int, hash []byte, fromTemporary bool) ([]byte, error) {
|
|
name = norm.NFC.String(filepath.ToSlash(name))
|
|
return c.Connection.Request(folder, name, offset, size, hash, fromTemporary)
|
|
}
|