Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d4ee3a82
Commit
d4ee3a82
authored
Jan 26, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert break when traversing directories for zip entries
parent
bb374fbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
internal/zipartifacts/metadata.go
internal/zipartifacts/metadata.go
+2
-4
internal/zipartifacts/metadata_test.go
internal/zipartifacts/metadata_test.go
+4
-3
No files found.
internal/zipartifacts/metadata.go
View file @
d4ee3a82
...
@@ -79,11 +79,9 @@ func generateZipMetadata(output io.Writer, archive *zip.Reader) error {
...
@@ -79,11 +79,9 @@ func generateZipMetadata(output io.Writer, archive *zip.Reader) error {
for
d
:=
path
.
Dir
(
entry
.
Name
);
d
!=
"."
&&
d
!=
"/"
;
d
=
path
.
Dir
(
d
)
{
for
d
:=
path
.
Dir
(
entry
.
Name
);
d
!=
"."
&&
d
!=
"/"
;
d
=
path
.
Dir
(
d
)
{
entryDir
:=
d
+
"/"
entryDir
:=
d
+
"/"
// If entryDir is already in the zipMap then so are all its parent directories
if
_
,
ok
:=
zipMap
[
entryDir
];
!
ok
{
if
_
,
ok
:=
zipMap
[
entryDir
];
ok
{
zipMap
[
entryDir
]
=
nil
break
}
}
zipMap
[
entryDir
]
=
nil
}
}
}
}
...
...
internal/zipartifacts/metadata_test.go
View file @
d4ee3a82
...
@@ -13,7 +13,8 @@ func TestMissingMetadataEntries(t *testing.T) {
...
@@ -13,7 +13,8 @@ func TestMissingMetadataEntries(t *testing.T) {
archive
:=
zip
.
NewWriter
(
&
zipBuffer
)
archive
:=
zip
.
NewWriter
(
&
zipBuffer
)
files
:=
[]
string
{
"file1"
,
"some/file/dir/file2"
,
"../../test12/test"
,
// non-POSIX paths are here just to test if we never enter infinite loop
files
:=
[]
string
{
"file1"
,
"some/file/dir/"
,
"some/file/dir/file2"
,
"../../test12/test"
,
"/usr/bin/test"
,
`c:\windows\win32.exe`
,
`c:/windows/win.dll`
,
"./f/asd"
,
"/"
}
"/usr/bin/test"
,
`c:\windows\win32.exe`
,
`c:/windows/win.dll`
,
"./f/asd"
,
"/"
}
for
_
,
file
:=
range
files
{
for
_
,
file
:=
range
files
{
...
@@ -32,9 +33,9 @@ func TestMissingMetadataEntries(t *testing.T) {
...
@@ -32,9 +33,9 @@ func TestMissingMetadataEntries(t *testing.T) {
t
.
Fatal
(
"zipartifacts: generateZipMetadata failed"
,
err
)
t
.
Fatal
(
"zipartifacts: generateZipMetadata failed"
,
err
)
}
}
paths
:=
[]
string
{
"file1"
,
"some/"
,
"some/file/"
,
"some/file/dir"
,
"some/file/dir/file2"
}
paths
:=
[]
string
{
"file1"
,
"some/"
,
"some/file/"
,
"some/file/dir
/
"
,
"some/file/dir/file2"
}
for
_
,
path
:=
range
paths
{
for
_
,
path
:=
range
paths
{
if
!
bytes
.
Contains
(
metaBuffer
.
Bytes
(),
[]
byte
(
path
))
{
if
!
bytes
.
Contains
(
metaBuffer
.
Bytes
(),
[]
byte
(
path
+
"
\x00
"
))
{
t
.
Fatal
(
"zipartifacts: metadata for path"
,
path
,
"not found"
)
t
.
Fatal
(
"zipartifacts: metadata for path"
,
path
,
"not found"
)
}
}
}
}
...
...
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