GUACAMOLE-347: Merge fix for IE lack of window.location.origin.

This commit is contained in:
Michael Jumper
2018-01-13 18:50:11 -08:00
2 changed files with 21 additions and 3 deletions

View File

@@ -189,8 +189,14 @@ angular.module('rest').factory('tunnelService', ['$injector',
*/ */
service.downloadStream = function downloadStream(tunnel, stream, mimetype, filename) { service.downloadStream = function downloadStream(tunnel, stream, mimetype, filename) {
// Work-around for IE missing window.location.origin
if (!$window.location.origin)
var streamOrigin = $window.location.protocol + '//' + $window.location.hostname + ($window.location.port ? (':' + $window.location.port) : '');
else
var streamOrigin = $window.location.origin;
// Build download URL // Build download URL
var url = $window.location.origin var url = streamOrigin
+ $window.location.pathname + $window.location.pathname
+ 'api/session/tunnels/' + encodeURIComponent(tunnel) + 'api/session/tunnels/' + encodeURIComponent(tunnel)
+ '/streams/' + encodeURIComponent(stream.index) + '/streams/' + encodeURIComponent(stream.index)
@@ -267,8 +273,14 @@ angular.module('rest').factory('tunnelService', ['$injector',
var deferred = $q.defer(); var deferred = $q.defer();
// Work-around for IE missing window.location.origin
if (!$window.location.origin)
var streamOrigin = $window.location.protocol + '//' + $window.location.hostname + ($window.location.port ? (':' + $window.location.port) : '');
else
var streamOrigin = $window.location.origin;
// Build upload URL // Build upload URL
var url = $window.location.origin var url = streamOrigin
+ $window.location.pathname + $window.location.pathname
+ 'api/session/tunnels/' + encodeURIComponent(tunnel) + 'api/session/tunnels/' + encodeURIComponent(tunnel)
+ '/streams/' + encodeURIComponent(stream.index) + '/streams/' + encodeURIComponent(stream.index)

View File

@@ -114,8 +114,14 @@ angular.module('rest').factory('UserCredentials', ['$injector', function defineU
*/ */
UserCredentials.getLink = function getLink(userCredentials) { UserCredentials.getLink = function getLink(userCredentials) {
// Work-around for IE missing window.location.origin
if (!$window.location.origin)
var linkOrigin = $window.location.protocol + '//' + $window.location.hostname + ($window.location.port ? (':' + $window.location.port) : '');
else
var linkOrigin = $window.location.origin;
// Build base link // Build base link
var link = $window.location.origin var link = linkOrigin
+ $window.location.pathname + $window.location.pathname
+ '#/'; + '#/';