File tree Expand file tree Collapse file tree
themes/arm-design-system-hugo-theme/static/js/eco-dashboard Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,11 @@ function normalizePackageName(input) {
5858 . toLowerCase ( ) ; // Convert to lowercase
5959}
6060
61+ function shouldUseTrailingSlashForPackageUrl ( ) {
62+ const currentHost = window . location . hostname . toLowerCase ( ) ;
63+ return currentHost . includes ( 'cloudfront.net' ) ;
64+ }
65+
6166function getDashboardPath ( dashboardPath ) {
6267 let normalizedPath = dashboardPath ;
6368
@@ -74,7 +79,13 @@ function getDashboardPath(dashboardPath) {
7479 normalizedPath = '/' + normalizedPath ;
7580 }
7681
77- return normalizedPath . replace ( / \/ $ / , '' ) || '/' ;
82+ normalizedPath = normalizedPath . replace ( / \/ + $ / , '' ) || '/' ;
83+
84+ if ( normalizedPath !== '/' && shouldUseTrailingSlashForPackageUrl ( ) ) {
85+ normalizedPath = normalizedPath + '/' ;
86+ }
87+
88+ return normalizedPath ;
7889}
7990
8091function normalizeDashboardUrlInAddressBar ( ) {
@@ -83,7 +94,11 @@ function normalizeDashboardUrlInAddressBar() {
8394 return ;
8495 }
8596
86- const normalizedPath = currentPath . replace ( / \/ + $ / , '' ) || '/' ;
97+ let normalizedPath = currentPath . replace ( / \/ + $ / , '' ) || '/' ;
98+ if ( normalizedPath !== '/' && shouldUseTrailingSlashForPackageUrl ( ) ) {
99+ normalizedPath = normalizedPath + '/' ;
100+ }
101+
87102 if ( normalizedPath === currentPath ) {
88103 return ;
89104 }
You can’t perform that action at this time.
0 commit comments