diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 21:08:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 21:08:47 +0300 |
commit | 6b9d3a4e8351e662c4586b24bb152de78ae9e3bf (patch) | |
tree | 883e9db60c047c54418fc1d2b1c5517f97e0f185 /app/controllers/concerns | |
parent | 23288f62da73fb0e30d8e7ce306665e8fda1b932 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r-- | app/controllers/concerns/membership_actions.rb | 4 | ||||
-rw-r--r-- | app/controllers/concerns/send_file_upload.rb | 16 |
2 files changed, 4 insertions, 16 deletions
diff --git a/app/controllers/concerns/membership_actions.rb b/app/controllers/concerns/membership_actions.rb index 993f091b0e6..1cf9046e30f 100644 --- a/app/controllers/concerns/membership_actions.rb +++ b/app/controllers/concerns/membership_actions.rb @@ -21,9 +21,9 @@ module MembershipActions member = Members::UpdateService .new(current_user, update_params) .execute(member) - .present(current_user: current_user) - present_members([member]) + member = present_members([member]).first + respond_to do |format| format.js { render 'shared/members/update', locals: { member: member } } end diff --git a/app/controllers/concerns/send_file_upload.rb b/app/controllers/concerns/send_file_upload.rb index 28e4cece548..2f5dc09be4a 100644 --- a/app/controllers/concerns/send_file_upload.rb +++ b/app/controllers/concerns/send_file_upload.rb @@ -3,7 +3,7 @@ module SendFileUpload def send_upload(file_upload, send_params: {}, redirect_params: {}, attachment: nil, proxy: false, disposition: 'attachment') if attachment - response_disposition = ::Gitlab::ContentDisposition.format(disposition: disposition, filename: attachment) + response_disposition = ActionDispatch::Http::ContentDisposition.format(disposition: disposition, filename: attachment) # Response-Content-Type will not override an existing Content-Type in # Google Cloud Storage, so the metadata needs to be cleared on GCS for @@ -15,7 +15,7 @@ module SendFileUpload # cross-origin JavaScript protection. send_params[:content_type] = 'text/plain' if File.extname(attachment) == '.js' - send_params.merge!(filename: attachment, disposition: utf8_encoded_disposition(disposition, attachment)) + send_params.merge!(filename: attachment, disposition: disposition) end if file_upload.file_storage? @@ -28,18 +28,6 @@ module SendFileUpload end end - # Since Rails 5 doesn't properly support support non-ASCII filenames, - # we have to add our own to ensure RFC 5987 compliance. However, Rails - # 5 automatically appends `filename#{filename}` here: - # https://github.com/rails/rails/blob/v5.0.7/actionpack/lib/action_controller/metal/data_streaming.rb#L137 - # Rails 6 will have https://github.com/rails/rails/pull/33829, so we - # can get rid of this special case handling when we upgrade. - def utf8_encoded_disposition(disposition, filename) - content = ::Gitlab::ContentDisposition.new(disposition: disposition, filename: filename) - - "#{disposition}; #{content.utf8_filename}" - end - def guess_content_type(filename) types = MIME::Types.type_for(filename) |