Skip to content

Full Toolkit for Next-Level Domain Analysis

Automatically cut protocol and path at the search (#9)

Mathis8750277bc8a3
diff --git a/components/SearchForm.tsx b/components/SearchForm.tsx
index c51a951..72bf9c7 100644
--- a/components/SearchForm.tsx
+++ b/components/SearchForm.tsx
@@ -38,7 +38,14 @@ const SearchForm = (props: SearchFormProps) => {
setError(false);
setState(FormStates.Submitting);
- const normalizedDomain = toASCII(domain.trim().toLowerCase());
+ let tDomain;
+ try {
+ tDomain = new URL(domain.trim().toLowerCase()).hostname;
+ } catch(err) {
+ tDomain = domain.trim().toLowerCase();
+ }
+
+ const normalizedDomain = toASCII(tDomain);
if (!isValidDomain(normalizedDomain)) {
setError(true);
@@ -92,7 +99,7 @@ const SearchForm = (props: SearchFormProps) => {
</p>
) : (
<p className="mt-2 text-center text-sm text-muted-foreground">
- It can be anything! An apex or subdomain.
+ It can be anything! An apex, subdomain or even an URL.
</p>
)}
</>