Skip to content

Commit

Permalink
Allow ENS available TLDs that are not ENS names (#1017)
Browse files Browse the repository at this point in the history
* fix

* clear circleci cache
  • Loading branch information
Bruno Barbieri authored Aug 21, 2019
1 parent 5939941 commit ef87c1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
aliases:
- &restore-cache
keys:
- v1.0.3-{{ .Branch }}-{{ checksum "package.json" }}
- v1.0.3-{{ .Branch }}
- v1.0.4-{{ .Branch }}-{{ checksum "package.json" }}
- v1.0.4-{{ .Branch }}

- &save-cache
key: v1.0.3-{{ .Branch }}-{{ checksum "package.json" }}
key: v1.0.4-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- node_modules
- &restore-node-cache
keys:
- v1.0.3-node-{{ .Branch }}-{{ checksum "package.json" }}
- v1.0.3-node-{{ .Branch }}
- v1.0.4-node-{{ .Branch }}-{{ checksum "package.json" }}
- v1.0.4-node-{{ .Branch }}
- &save-node-cache
key: v1.0.3-node-{{ .Branch }}-{{ checksum "package.json" }}
key: v1.0.4-node-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- node_modules

Expand Down
15 changes: 13 additions & 2 deletions app/components/Views/BrowserTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ export class BrowserTab extends PureComponent {

webview = React.createRef();
inputRef = React.createRef();
ensIgnoreList = [];
snapshotTimer = null;
lastUrlBeforeHome = null;
goingBack = false;
Expand Down Expand Up @@ -816,7 +817,10 @@ export class BrowserTab extends PureComponent {
const { hostname } = urlObj;
const tld = hostname.split('.').pop();
if (AppConstants.supportedTLDs.indexOf(tld.toLowerCase()) !== -1) {
return true;
// Make sure it's not in the ignore list
if (this.ensIgnoreList.indexOf(hostname) === -1) {
return true;
}
}
return false;
}
Expand Down Expand Up @@ -921,9 +925,16 @@ export class BrowserTab extends PureComponent {
type
};
} catch (err) {
// This is a TLD that might be a normal website
// For example .XYZ and might be more in the future
if (hostname.substr(-4) !== '.eth' && err.toString().indexOf('is not standard') !== -1) {
this.ensIgnoreList.push(hostname);
this.go(fullUrl);
return { url: null };
}
Logger.error('Failed to resolve ENS name', err);
Alert.alert(strings('browser.error'), strings('browser.failed_to_resolve_ens_name'));
return null;
return { url: null };
}
}

Expand Down

0 comments on commit ef87c1f

Please sign in to comment.