Skip to content

Commit 9782313

Browse files
authored
Merge pull request #22 from webrecorder/handle-invalid-url
Handle invalid page URL
2 parents 772a177 + 9c940f1 commit 9782313

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/archive-now.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,14 @@ class ArchiveNow extends LitElement {
204204

205205
case "live-proxy-url-error":
206206
if (event.data.status === 403) {
207-
this.errorMessage =
208-
"It looks like this site is blocking us from loading it.";
207+
// Since https://example is a valid URL, manually check for basic domain syntax
208+
if (event.data.url.indexOf(".") > 0) {
209+
this.errorMessage =
210+
"It looks like this site is blocking us from loading it.";
211+
} else {
212+
this.errorMessage =
213+
"It looks like this might not be a valid URL, or the site is blocking us from loading it.";
214+
}
209215
} else if (event.data.status > 500) {
210216
this.errorMessage =
211217
"It looks like this might not be a valid URL, or the site is down.";

0 commit comments

Comments
 (0)