5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 19:46:22 +00:00

fix: fix typo and change response to platforms #13903
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
jazzari 2023-08-16 12:58:14 -03:00
parent aeb2105dc7
commit 5ac628b38a

View file

@ -40,8 +40,10 @@ module Api
elsif request.headers['X-HUB-SIGNATURE-256']
token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256'])
# Gitea
elsif
token_from_signature(request.env['HTTP_X_GITEA_SIGNATURE'])
else
token_from_signatureq(request.env['HTTP_X_GITEA_SIGNATURE'])
raise ActiveRecord::RecordNotFound
end
end
end
@ -55,10 +57,7 @@ module Api
new_signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload)
ActiveSupport::SecurityUtils.secure_compare(new_signature, signature)
end.tap do |t|
raise ArgumentError, 'token no encontrado' if t.nil?
rescue ArgumentError => e
ExceptionNotifier.notify_exception(e, data: { params: params.to_h })
raise ActiveRecord::RecordNotFound
raise ActiveRecord::RecordNotFound if t.nil?
end
end
@ -70,6 +69,9 @@ module Api
# respuesta de error a plataformas
def platforms_answer
head :forbidden
raise ArgumentError, 'token no encontrado'
rescue ArgumentError => e
ExceptionNotifier.notify_exception(e, data: { params: params.to_h })
end
end
end