Change window.location.origin usages to document.baseURI (#13180)

pull/13192/head
Douglas Gubert 7 years ago committed by GitHub
parent 185b7b6aac
commit a2bdd3b8fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/rocketchat-lib/client/lib/RestApiClient.js
  2. 2
      packages/rocketchat-ui/client/components/icon.js

@ -44,7 +44,7 @@ RocketChat.API = {
return new Promise(function _rlRestApiGet(resolve, reject) {
jQuery.ajax({
method,
url: `${ window.location.origin }/api/${ endpoint }${ query }`,
url: `${ document.baseURI }api/${ endpoint }${ query }`,
headers: {
'Content-Type': 'application/json',
'X-User-Id': localStorage['Meteor.userId'],
@ -72,7 +72,7 @@ RocketChat.API = {
return new Promise(function _jqueryFormDataPromise(resolve, reject) {
jQuery.ajax({
url: `${ window.location.origin }/api/${ endpoint }${ query }`,
url: `${ document.baseURI }api/${ endpoint }${ query }`,
headers: {
'X-User-Id': localStorage['Meteor.userId'],
'X-Auth-Token': localStorage['Meteor.loginToken'],

@ -2,7 +2,7 @@ import { FlowRouter } from 'meteor/kadira:flow-router';
import { Template } from 'meteor/templating';
import { isChrome, isFirefox } from 'meteor/rocketchat:utils';
const baseUrlFix = () => `${ window.location.origin }${ FlowRouter.current().path }`;
const baseUrlFix = () => `${ document.baseURI }${ FlowRouter.current().path.substring(1) }`;
Template.icon.helpers({
baseUrl: ((isFirefox && isFirefox[1] < 55) || (isChrome && isChrome[1] < 55)) ? baseUrlFix : undefined,

Loading…
Cancel
Save