mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 22:36:21 +00:00
fix: fix typo and change response to platforms #13903
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
aeb2105dc7
commit
5ac628b38a
1 changed files with 7 additions and 5 deletions
|
@ -40,8 +40,10 @@ module Api
|
||||||
elsif request.headers['X-HUB-SIGNATURE-256']
|
elsif request.headers['X-HUB-SIGNATURE-256']
|
||||||
token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256'])
|
token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256'])
|
||||||
# Gitea
|
# Gitea
|
||||||
|
elsif
|
||||||
|
token_from_signature(request.env['HTTP_X_GITEA_SIGNATURE'])
|
||||||
else
|
else
|
||||||
token_from_signatureq(request.env['HTTP_X_GITEA_SIGNATURE'])
|
raise ActiveRecord::RecordNotFound
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -55,10 +57,7 @@ module Api
|
||||||
new_signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload)
|
new_signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload)
|
||||||
ActiveSupport::SecurityUtils.secure_compare(new_signature, signature)
|
ActiveSupport::SecurityUtils.secure_compare(new_signature, signature)
|
||||||
end.tap do |t|
|
end.tap do |t|
|
||||||
raise ArgumentError, 'token no encontrado' if t.nil?
|
raise ActiveRecord::RecordNotFound if t.nil?
|
||||||
rescue ArgumentError => e
|
|
||||||
ExceptionNotifier.notify_exception(e, data: { params: params.to_h })
|
|
||||||
raise ActiveRecord::RecordNotFound
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -70,6 +69,9 @@ module Api
|
||||||
# respuesta de error a plataformas
|
# respuesta de error a plataformas
|
||||||
def platforms_answer
|
def platforms_answer
|
||||||
head :forbidden
|
head :forbidden
|
||||||
|
raise ArgumentError, 'token no encontrado'
|
||||||
|
rescue ArgumentError => e
|
||||||
|
ExceptionNotifier.notify_exception(e, data: { params: params.to_h })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue