From 197e97b0b720918f7cdcadded393a848a8e49252 Mon Sep 17 00:00:00 2001 From: Chapuis Bertil Date: Tue, 15 Sep 2015 18:41:00 +0200 Subject: [PATCH] accept http urls without trailing slash --- cmd/restic/global.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/restic/global.go b/cmd/restic/global.go index 3cae4e5e4..b8b6da2e3 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -151,14 +151,16 @@ func open(u string) (backend.Backend, error) { return local.Open(url.Path) } + if url.Scheme == "http" || url.Scheme == "https" { + return rest.Open(url) + } + if len(url.Path) < 1 { return nil, fmt.Errorf("unable to parse url %v", url) } if url.Scheme == "s3" { return s3.Open(url.Host, url.Path[1:]) - } else if url.Scheme == "http" || url.Scheme == "https" { - return rest.Open(url) } args := []string{url.Host} @@ -188,15 +190,16 @@ func create(u string) (backend.Backend, error) { return local.Create(url.Path) } + if url.Scheme == "http" || url.Scheme == "https" { + return rest.Open(url) + } + if len(url.Path) < 1 { return nil, fmt.Errorf("unable to parse url %v", url) } if url.Scheme == "s3" { return s3.Open(url.Host, url.Path[1:]) - } else if url.Scheme == "http" || url.Scheme == "https" { - - return rest.Open(url) } args := []string{url.Host}