Skip to content

Commit

Permalink
Don't consider path fragments with a single element to be a domain
Browse files Browse the repository at this point in the history
  • Loading branch information
erayd committed Sep 29, 2019
1 parent ce56c8d commit bbf2e4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ function prepareLogins(files, settings) {
allowFill: true
};
let domainInfo = pathToDomainInfo(storeId + "/" + login.login, settings.host);
login.domain = domainInfo ? domainInfo.hostname : null;
login.domain = domainInfo ? domainInfo.hostname : "";
login.inCurrentHost =
host.hostname == login.domain || host.hostname.endsWith("." + login.domain);
host.hostname == login.domain || // host matches path component exactly
(login.domain.includes(".") && // path component is not a single level (e.g. com, net, local)...
host.hostname.endsWith("." + login.domain)); // ...and the host ends with that path component
if (domainInfo && domainInfo.port && domainInfo.port !== host.port) {
login.inCurrentHost = false;
}
Expand Down

0 comments on commit bbf2e4d

Please sign in to comment.