From 393f0dd42946131ea3ed956bd1a510b450cfcb43 Mon Sep 17 00:00:00 2001 From: yxxhero Date: Mon, 12 Feb 2024 09:35:33 +0800 Subject: [PATCH] fix issues Signed-off-by: yxxhero --- pkg/remote/remote.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/remote/remote.go b/pkg/remote/remote.go index 23167b0a..61cf4214 100644 --- a/pkg/remote/remote.go +++ b/pkg/remote/remote.go @@ -124,7 +124,6 @@ func Parse(goGetterSrc string) (*Source, error) { return nil, InvalidURLError{err: fmt.Sprintf("parse url: missing scheme - probably this is a local file path? %s", goGetterSrc)} } - var sourceDir, sourceFile string pathComponents := strings.Split(u.Path, "@") if len(pathComponents) != 2 { @@ -138,18 +137,18 @@ func Parse(goGetterSrc string) (*Source, error) { } pathComponents = []string{dir, filepath.Base(u.Path)} } + } else { + dir := pathComponents[0][1:] + pathComponents = []string{dir, pathComponents[1]} } - sourceDir = pathComponents[0] - sourceFile = pathComponents[1] - return &Source{ Getter: getter, User: u.User.String(), Scheme: u.Scheme, Host: u.Host, - Dir: sourceDir, - File: sourceFile, + Dir: pathComponents[0], + File: pathComponents[1], RawQuery: u.RawQuery, }, nil }