From 16221facb9066ccf03015ccfe9e7ca784b0d2099 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 9 May 2020 17:36:41 +0200 Subject: ctlsock: create exported ctlsock client library The former interal ctlsock server package is renamed to ctlsocksrv. --- internal/ctlsock/sanitize.go | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 internal/ctlsock/sanitize.go (limited to 'internal/ctlsock/sanitize.go') diff --git a/internal/ctlsock/sanitize.go b/internal/ctlsock/sanitize.go deleted file mode 100644 index 7cf77a5..0000000 --- a/internal/ctlsock/sanitize.go +++ /dev/null @@ -1,32 +0,0 @@ -package ctlsock - -import ( - "path/filepath" - "strings" -) - -// SanitizePath adapts filepath.Clean for FUSE paths. -// 1) Leading slash(es) are dropped -// 2) It returns "" instead of "." -// 3) If the cleaned path points above CWD (start with ".."), an empty string -// is returned -// See the TestSanitizePath testcases for examples. -func SanitizePath(path string) string { - // (1) - for len(path) > 0 && path[0] == '/' { - path = path[1:] - } - if len(path) == 0 { - return "" - } - clean := filepath.Clean(path) - // (2) - if clean == "." { - return "" - } - // (3) - if clean == ".." || strings.HasPrefix(clean, "../") { - return "" - } - return clean -} -- cgit v1.2.3