From af960b9b407a66ed6bf0cfb70f6ad3f1a251ae52 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 3 Nov 2015 18:47:11 +0100 Subject: [PATCH] Simplify Implementation of Join --- backend/sftp/sftp.go | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go index a4abf94c0..4166bdb7f 100644 --- a/backend/sftp/sftp.go +++ b/backend/sftp/sftp.go @@ -288,23 +288,7 @@ func (r *SFTP) Create() (backend.Blob, error) { } func Join(parts ...string) string { - if len(parts) == 0 { - return "" - } - - result := strings.TrimRight(parts[0], "/") - if len(parts) == 1 { - return result - } - - for _, s := range parts[1:] { - s = strings.TrimRight(s, "/") - if len(s) == 0 { - continue - } - result = result + "/" + s - } - return result + return filepath.Clean(strings.Join(parts, "/")) } // Construct path for given backend.Type and name.