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
6e29c1de
Commit
6e29c1de
authored
Sep 28, 2020
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `safezip_use_rubyzip` feature flag
This is enabled and no longer needed.
parent
3fd9cc8a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
65 deletions
+6
-65
config/feature_flags/development/safezip_use_rubyzip.yml
config/feature_flags/development/safezip_use_rubyzip.yml
+0
-7
lib/safe_zip/extract.rb
lib/safe_zip/extract.rb
+1
-21
spec/lib/safe_zip/extract_spec.rb
spec/lib/safe_zip/extract_spec.rb
+5
-31
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+0
-6
No files found.
config/feature_flags/development/safezip_use_rubyzip.yml
deleted
100644 → 0
View file @
3fd9cc8a
---
name
:
safezip_use_rubyzip
introduced_by_url
:
rollout_issue_url
:
group
:
type
:
development
default_enabled
:
true
lib/safe_zip/extract.rb
View file @
6e29c1de
...
...
@@ -19,11 +19,7 @@ module SafeZip
def
extract
(
opts
=
{})
params
=
SafeZip
::
ExtractParams
.
new
(
**
opts
)
if
Feature
.
enabled?
(
:safezip_use_rubyzip
,
default_enabled:
true
)
extract_with_ruby_zip
(
params
)
else
legacy_unsafe_extract_with_system_zip
(
params
)
end
end
private
...
...
@@ -53,21 +49,5 @@ module SafeZip
.
extract
end
end
def
legacy_unsafe_extract_with_system_zip
(
params
)
# Requires UnZip at least 6.00 Info-ZIP.
# -n never overwrite existing files
args
=
%W(unzip -n -qq
#{
archive_path
}
)
# We add * to end of directory, because we want to extract directory and all subdirectories
args
+=
params
.
directories_wildcard
# Target directory where we extract
args
+=
%W(-d
#{
params
.
extract_path
}
)
unless
system
(
*
args
)
raise
Error
,
'archive failed to extract'
end
end
end
end
spec/lib/safe_zip/extract_spec.rb
View file @
6e29c1de
...
...
@@ -15,11 +15,7 @@ RSpec.describe SafeZip::Extract do
describe
'#extract'
do
subject
{
object
.
extract
(
directories:
directories
,
to:
target_path
)
}
shared_examples
'extracts archive'
do
|
param
|
before
do
stub_feature_flags
(
safezip_use_rubyzip:
param
)
end
shared_examples
'extracts archive'
do
it
'does extract archive'
do
subject
...
...
@@ -28,11 +24,7 @@ RSpec.describe SafeZip::Extract do
end
end
shared_examples
'fails to extract archive'
do
|
param
|
before
do
stub_feature_flags
(
safezip_use_rubyzip:
param
)
end
shared_examples
'fails to extract archive'
do
it
'does not extract archive'
do
expect
{
subject
}.
to
raise_error
(
SafeZip
::
Extract
::
Error
)
end
...
...
@@ -42,13 +34,7 @@ RSpec.describe SafeZip::Extract do
context
"when using
#{
name
}
archive"
do
let
(
:archive_name
)
{
name
}
context
'for RubyZip'
do
it_behaves_like
'extracts archive'
,
true
end
context
'for UnZip'
do
it_behaves_like
'extracts archive'
,
false
end
it_behaves_like
'extracts archive'
end
end
...
...
@@ -56,13 +42,7 @@ RSpec.describe SafeZip::Extract do
context
"when using
#{
name
}
archive"
do
let
(
:archive_name
)
{
name
}
context
'for RubyZip'
do
it_behaves_like
'fails to extract archive'
,
true
end
context
'for UnZip (UNSAFE)'
do
it_behaves_like
'extracts archive'
,
false
end
it_behaves_like
'fails to extract archive'
end
end
...
...
@@ -70,13 +50,7 @@ RSpec.describe SafeZip::Extract do
let
(
:archive_name
)
{
'valid-simple.zip'
}
let
(
:directories
)
{
%w(non/existing)
}
context
'for RubyZip'
do
it_behaves_like
'fails to extract archive'
,
true
end
context
'for UnZip'
do
it_behaves_like
'fails to extract archive'
,
false
end
it_behaves_like
'fails to extract archive'
end
end
end
spec/services/projects/update_pages_service_spec.rb
View file @
6e29c1de
...
...
@@ -16,8 +16,6 @@ RSpec.describe Projects::UpdatePagesService do
subject
{
described_class
.
new
(
project
,
build
)
}
before
do
stub_feature_flags
(
safezip_use_rubyzip:
true
)
project
.
remove_pages
end
...
...
@@ -104,10 +102,6 @@ RSpec.describe Projects::UpdatePagesService do
let
(
:file
)
{
fixture_file_upload
(
"spec/fixtures/pages_non_writeable.zip"
)
}
context
'when using RubyZip'
do
before
do
stub_feature_flags
(
safezip_use_rubyzip:
true
)
end
it
'succeeds to extract'
do
expect
(
execute
).
to
eq
(
:success
)
expect
(
project
.
pages_metadatum
).
to
be_deployed
...
...
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