1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-16 00:00:05 +01:00

accept http urls without trailing slash

This commit is contained in:
Chapuis Bertil 2015-09-15 18:41:00 +02:00
parent d41b3b0302
commit 197e97b0b7

View file

@ -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}