diff --git a/app/assets/javascripts/app/controllers/import_zendesk.coffee b/app/assets/javascripts/app/controllers/import_zendesk.coffee index b076c7210..ee12e9177 100644 --- a/app/assets/javascripts/app/controllers/import_zendesk.coffee +++ b/app/assets/javascripts/app/controllers/import_zendesk.coffee @@ -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') diff --git a/app/controllers/import_zendesk_controller.rb b/app/controllers/import_zendesk_controller.rb index b77056e3a..f762c2321 100644 --- a/app/controllers/import_zendesk_controller.rb +++ b/app/controllers/import_zendesk_controller.rb @@ -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: {