MCPcopy
hub / github.com/syncthing/syncthing / deslashify

Function deslashify

lib/protocol/encryption.go:638–644  ·  view source on GitHub ↗

deslashify removes slashes and encrypted file extensions from the string. This is the inverse of slashify().

(s string)

Source from the content-addressed store, hash-verified

636// deslashify removes slashes and encrypted file extensions from the string.
637// This is the inverse of slashify().
638func deslashify(s string) (string, error) {
639 if s == "" || !strings.HasPrefix(s[1:], encryptedDirExtension) {
640 return "", fmt.Errorf("invalid encrypted path: %q", s)
641 }
642 s = s[:1] + s[1+len(encryptedDirExtension):]
643 return strings.ReplaceAll(s, "/", ""), nil
644}
645
646type rawResponse struct {
647 data []byte

Callers 1

decryptNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected