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
05f4efc6
Commit
05f4efc6
authored
Jul 20, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: Properly handle ? in URLs in cache keys
/cc @sit - Found another edge case
parent
f6854ae0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
packer/cache.go
packer/cache.go
+7
-7
packer/cache_test.go
packer/cache_test.go
+2
-2
No files found.
packer/cache.go
View file @
05f4efc6
...
@@ -73,14 +73,14 @@ func (f *FileCache) RUnlock(key string) {
...
@@ -73,14 +73,14 @@ func (f *FileCache) RUnlock(key string) {
func
(
f
*
FileCache
)
cachePath
(
key
string
,
hashKey
string
)
string
{
func
(
f
*
FileCache
)
cachePath
(
key
string
,
hashKey
string
)
string
{
suffix
:=
""
suffix
:=
""
dotIndex
:=
strings
.
LastIndex
(
key
,
"."
)
endIndex
:=
strings
.
Index
(
key
,
"?"
)
if
dotIndex
>
-
1
{
if
endIndex
==
-
1
{
suffix
=
key
[
dotIndex
:
len
(
key
)]
endIndex
=
len
(
key
)
}
idx
:=
strings
.
Index
(
suffix
,
"?"
)
dotIndex
:=
strings
.
LastIndex
(
key
[
0
:
endIndex
],
"."
)
if
idx
!=
-
1
{
if
dotIndex
>
-
1
{
suffix
=
suffix
[
0
:
idx
]
suffix
=
key
[
dotIndex
:
endIndex
]
}
}
}
return
filepath
.
Join
(
f
.
CacheDir
,
hashKey
+
suffix
)
return
filepath
.
Join
(
f
.
CacheDir
,
hashKey
+
suffix
)
...
...
packer/cache_test.go
View file @
05f4efc6
...
@@ -37,8 +37,8 @@ func TestFileCache(t *testing.T) {
...
@@ -37,8 +37,8 @@ func TestFileCache(t *testing.T) {
defer
os
.
RemoveAll
(
cacheDir
)
defer
os
.
RemoveAll
(
cacheDir
)
cache
:=
&
FileCache
{
CacheDir
:
cacheDir
}
cache
:=
&
FileCache
{
CacheDir
:
cacheDir
}
path
:=
cache
.
Lock
(
"foo.ext?foo=bar"
)
path
:=
cache
.
Lock
(
"foo.ext?foo=bar
.foo
"
)
defer
cache
.
Unlock
(
"foo.ext?foo=bar"
)
defer
cache
.
Unlock
(
"foo.ext?foo=bar
.foo
"
)
if
!
strings
.
HasSuffix
(
path
,
".ext"
)
{
if
!
strings
.
HasSuffix
(
path
,
".ext"
)
{
t
.
Fatalf
(
"bad extension with question mark: %s"
,
path
)
t
.
Fatalf
(
"bad extension with question mark: %s"
,
path
)
}
}
...
...
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