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!',
}
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?
message_human = ''
@ -40,8 +40,7 @@ class ImportZendeskController < ApplicationController
return
end
# since 2016-10-15 a redirect to a marketing page has been implemented
if response.body.exclude?(params[:url])
if response.header['x-zendesk-api-version'].blank?
render json: {
result: 'invalid',
message_human: 'Hostname not found!',