Improved url error handling.

This commit is contained in:
Martin Edenhofer 2017-08-02 08:11:03 +02:00
parent 4eec956cbe
commit dd29b0692c
2 changed files with 2 additions and 2 deletions

View file

@ -117,7 +117,7 @@ class Index extends App.ControllerContent
e.preventDefault()
@urlStatus.attr('data-state', '')
url = @zendeskUrl.val() + '/agent/admin/api'
@zendeskUrlApiToken.attr('href', url.replace('//', '/'))
@zendeskUrlApiToken.attr('href', url.replace(/[^:]\/\//, '/'))
@zendeskUrlApiToken.val('HERE')
@$('[data-slide=zendesk-url]').toggleClass('hide')
@$('[data-slide=zendesk-credentials]').toggleClass('hide')

View file

@ -50,7 +50,7 @@ class ImportZendeskController < ApplicationController
end
endpoint = "#{params[:url]}/api/v2"
endpoint.gsub('//', '/')
endpoint.gsub(%r{[^:]//}, '/')
Setting.set('import_zendesk_endpoint', endpoint)
render json: {