Commit 3dfd44d4 authored by Patrick Bajao's avatar Patrick Bajao

Merge branch 'pl-ruby-kwargs-warnings-jwt-token' into 'master'

Fix kwargs deprecation warnings for jwt_token helper

See merge request gitlab-org/gitlab!47791
parents 5dc0e503 cf2219fc
...@@ -37,7 +37,7 @@ module MultipartHelpers ...@@ -37,7 +37,7 @@ module MultipartHelpers
# *without* the "#{key}." prefix # *without* the "#{key}." prefix
result.deep_transform_keys! { |k| k.remove("#{key}.") } result.deep_transform_keys! { |k| k.remove("#{key}.") }
{ {
"#{key}.gitlab-workhorse-upload" => jwt_token('upload' => result) "#{key}.gitlab-workhorse-upload" => jwt_token(data: { 'upload' => result })
} }
end end
......
...@@ -85,15 +85,15 @@ module WorkhorseHelpers ...@@ -85,15 +85,15 @@ module WorkhorseHelpers
return {} if upload_params.empty? return {} if upload_params.empty?
{ "#{key}.gitlab-workhorse-upload" => jwt_token('upload' => upload_params) } { "#{key}.gitlab-workhorse-upload" => jwt_token(data: { 'upload' => upload_params }) }
end end
def jwt_token(data = {}, issuer: 'gitlab-workhorse', secret: Gitlab::Workhorse.secret, algorithm: 'HS256') def jwt_token(data: {}, issuer: 'gitlab-workhorse', secret: Gitlab::Workhorse.secret, algorithm: 'HS256')
JWT.encode({ 'iss' => issuer }.merge(data), secret, algorithm) JWT.encode({ 'iss' => issuer }.merge(data), secret, algorithm)
end end
def workhorse_rewritten_fields_header(fields) def workhorse_rewritten_fields_header(fields)
{ Gitlab::Middleware::Multipart::RACK_ENV_KEY => jwt_token('rewritten_fields' => fields) } { Gitlab::Middleware::Multipart::RACK_ENV_KEY => jwt_token(data: { 'rewritten_fields' => fields }) }
end end
def workhorse_disk_accelerated_file_params(key, file) def workhorse_disk_accelerated_file_params(key, file)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment