Skip to content

Commit 8828f1c

Browse files
committed
Added support for subdirectory #875
1 parent 9e4c9cd commit 8828f1c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/assets/javascripts/utils.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ function getNextInstance(currentInstanceUrl, instances) {
2424
* @param {URL} url
2525
*/
2626
function protocolHost(url) {
27-
if (url.username && url.password) return `${url.protocol}//${url.username}:${url.password}@${url.host}`
27+
url.pathname = url.pathname.replace(/\/$/, '');
28+
if (url.username && url.password) return `${url.protocol}//${url.username}:${url.password}@${url.host}${url.pathname}`
29+
30+
// workaround
2831
if (url.pathname == "/TekstoLibre/" && url.host.endsWith("github.io"))
29-
// workaround
3032
return `${url.protocol}//${url.host}${url.pathname.slice(0, -1)}`
31-
return `${url.protocol}//${url.host}`
33+
34+
return `${url.protocol}//${url.host}${url.pathname}`
3235
}
3336

3437
/**
@@ -221,5 +224,5 @@ export default {
221224
addressToLatLng,
222225
getQuery,
223226
prefsEncoded,
224-
convertMapCentre
227+
convertMapCentre,
225228
}

0 commit comments

Comments
 (0)