Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
3ae0b2f0
Commit
3ae0b2f0
authored
Jul 29, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/common: Don't prepend slash to URL path if path is empty
parent
c06c1fee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
builder/common/config.go
builder/common/config.go
+2
-2
builder/common/config_test.go
builder/common/config_test.go
+10
-0
No files found.
builder/common/config.go
View file @
3ae0b2f0
...
...
@@ -2,11 +2,11 @@ package common
import
(
"fmt"
"path/filepath"
"github.com/mitchellh/mapstructure"
"github.com/mitchellh/packer/packer"
"net/url"
"os"
"path/filepath"
"sort"
"strings"
)
...
...
@@ -97,7 +97,7 @@ func DownloadableURL(original string) (string, error) {
// we distribute with a version of Go that fixes that bug.
//
// See: https://code.google.com/p/go/issues/detail?id=5927
if
url
.
Path
[
0
]
!=
'/'
{
if
url
.
Path
!=
""
&&
url
.
Path
[
0
]
!=
'/'
{
url
.
Path
=
"/"
+
url
.
Path
}
...
...
builder/common/config_test.go
View file @
3ae0b2f0
...
...
@@ -88,6 +88,16 @@ func TestDownloadableURL(t *testing.T) {
if
u
!=
"http://packer.io/path"
{
t
.
Fatalf
(
"bad: %s"
,
u
)
}
// No path
u
,
err
=
DownloadableURL
(
"HTTP://packer.io"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
u
!=
"http://packer.io"
{
t
.
Fatalf
(
"bad: %s"
,
u
)
}
}
func
TestDownloadableURL_FilePaths
(
t
*
testing
.
T
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment