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
07451246
Commit
07451246
authored
Sep 04, 2020
by
Aleksei Lipniagov
Committed by
Kamil Trzciński
Sep 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow image resizing if `current_user=nil`
parent
1e3eb8aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
app/controllers/concerns/send_file_upload.rb
app/controllers/concerns/send_file_upload.rb
+1
-2
spec/controllers/concerns/send_file_upload_spec.rb
spec/controllers/concerns/send_file_upload_spec.rb
+17
-0
No files found.
app/controllers/concerns/send_file_upload.rb
View file @
07451246
...
...
@@ -55,8 +55,7 @@ module SendFileUpload
def
image_scaling_request?
(
file_upload
)
avatar_safe_for_scaling?
(
file_upload
)
&&
scaling_allowed_by_feature_flags?
(
file_upload
)
&&
valid_image_scaling_width?
&&
current_user
valid_image_scaling_width?
end
def
avatar_safe_for_scaling?
(
file_upload
)
...
...
spec/controllers/concerns/send_file_upload_spec.rb
View file @
07451246
...
...
@@ -79,6 +79,23 @@ RSpec.describe SendFileUpload do
it_behaves_like
'handles image resize requests allowed by FFs'
end
context
'when boths FFs are enabled globally'
do
before
do
stub_feature_flags
(
dynamic_image_resizing_requester:
true
)
stub_feature_flags
(
dynamic_image_resizing_owner:
true
)
end
it_behaves_like
'handles image resize requests allowed by FFs'
context
'when current_user is nil'
do
before
do
allow
(
controller
).
to
receive
(
:current_user
).
and_return
(
nil
)
end
it_behaves_like
'handles image resize requests allowed by FFs'
end
end
context
'when only FF based on content requester is enabled for current user'
do
before
do
stub_feature_flags
(
dynamic_image_resizing_requester:
image_requester
)
...
...
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