Fixes #3679 - Zendesk URL check fails with Net::HTTPForbidden 403 error.

This commit is contained in:
Thorsten Eckel 2021-07-28 08:53:18 +02:00
parent f50016b008
commit e9a442160b

View file

@ -23,7 +23,7 @@ class ImportZendeskController < ApplicationController
'Connection refused' => 'Connection refused!', 'Connection refused' => 'Connection refused!',
} }
response = UserAgent.request(params[:url], verify_ssl: true) response = UserAgent.request(URI.join(params[:url], '/api/v2/users/me').to_s, verify_ssl: true)
if !response.success? if !response.success?
message_human = '' message_human = ''
@ -40,8 +40,7 @@ class ImportZendeskController < ApplicationController
return return
end end
# since 2016-10-15 a redirect to a marketing page has been implemented if response.header['x-zendesk-api-version'].blank?
if response.body.exclude?(params[:url])
render json: { render json: {
result: 'invalid', result: 'invalid',
message_human: 'Hostname not found!', message_human: 'Hostname not found!',