Skip to content

Commit 1165224

Browse files
authored
Merge pull request #114 from webdev-dev/master
extLink module fix
2 parents 9147168 + 688e322 commit 1165224

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ services:
2121
- VIRTUAL_HOST=webdevff0b3218aaad11e7abc4cec278b6b50a_JEKYLL_HOST
2222
- CERT_NAME=webdevff0b3218aaad11e7abc4cec278b6b50a_ENV_DOMAIN
2323
ports:
24-
- "4000:4000"
24+
- "4000"
2525
volumes:
2626
- .:/usr/src/app
27-
command: bash -c 'cd /usr/src/app; sudo bundle update; jekyll serve -d _site --watch --host=0.0.0.0 --port webdevff0b3218aaad11e7abc4cec278b6b50a_JEKYLL_PORT'
27+
command: bash -c 'cd /usr/src/app; jekyll serve -d _site --watch --host=0.0.0.0 --port webdevff0b3218aaad11e7abc4cec278b6b50a_JEKYLL_PORT'
2828
image: jekyll:docker
2929
container_name: webdevff0b3218aaad11e7abc4cec278b6b50a_JEKYLL_CONTAINER
3030
external_links:

lib/util/jquery.extLink.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ var extLink = exports.extLink = function extLink($, _config) {
3939
}
4040

4141
// Strip the host name down, removing ports, subdomains, or www.
42-
var pattern = /^(([^\/:]+?\.)*)([^\.:]{1,})((\.[a-z0-9]{1,253})*)(:[0-9]{1,5})?$/;
42+
var pattern = /^(([^\/:]+?\.)*)([^\.:]{4,})((\.[a-z]{1,4})*)(:[0-9]{1,5})?$/;
4343
var host = window.location.host.replace(pattern, '$3$4');
4444
var subdomain = window.location.host.replace(pattern, '$1');
45+
if (subdomain == host) {
46+
subdomain = "";
47+
}
4548

4649
// Determine what subdomains are considered internal.
4750
var subdomains;

src/util/jquery.extLink.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ export const extLink = ($, _config) => {
3131
}
3232

3333
// Strip the host name down, removing ports, subdomains, or www.
34-
var pattern = /^(([^\/:]+?\.)*)([^\.:]{1,})((\.[a-z0-9]{1,253})*)(:[0-9]{1,5})?$/;
34+
var pattern = /^(([^\/:]+?\.)*)([^\.:]{4,})((\.[a-z]{1,4})*)(:[0-9]{1,5})?$/;
3535
var host = window.location.host.replace(pattern, '$3$4');
3636
var subdomain = window.location.host.replace(pattern, '$1');
37+
if (subdomain == host) {
38+
subdomain = "";
39+
}
3740

3841
// Determine what subdomains are considered internal.
3942
var subdomains;

0 commit comments

Comments
 (0)