fix(containers): correct base URL construction for console access

Fixed an issue where the base URL for WebSocket connection in the console was being duplicated. The base href and window.location.origin were both set to "http://localhost:49000", resulting in a duplicated URL like "http://localhost:49000http://localhost:49000". This fix ensures that the base URL is properly constructed without duplication.
pull/12191/head
강지원 2024-09-05 14:56:34 +09:00
parent 4bb5a7f480
commit 549ee0a945
1 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ angular.module('portainer.docker').controller('ContainerConsoleController', [
id: attachId,
};
const base = window.location.origin.startsWith('http') ? `${window.location.origin}${baseHref()}` : baseHref();
const base = window.location.origin.startsWith('http') && !window.ddExtension ? `${window.location.origin}${baseHref()}` : baseHref();
var url =
base +
'api/websocket/attach?' +
@ -96,7 +96,7 @@ angular.module('portainer.docker').controller('ContainerConsoleController', [
id: data.Id,
};
const base = window.location.origin.startsWith('http') ? `${window.location.origin}${baseHref()}` : baseHref();
const base = window.location.origin.startsWith('http') && !window.ddExtension ? `${window.location.origin}${baseHref()}` : baseHref();
var url =
base +
'api/websocket/exec?' +