Skip to content

Commit 6661156

Browse files
authored
Merge pull request #2350 from seefood/fix/down4me-url-malformation
2 parents d2504e0 + b5eb532 commit 6661156

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/available/base.plugin.bash

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ function ips() {
1616

1717
function down4me() {
1818
about 'checks whether a website is down for you, or everybody'
19-
param '1: website url'
19+
param '1: website url or domain'
2020
example '$ down4me http://www.google.com'
21+
example '$ down4me google.com'
2122
group 'base'
22-
curl -Ls "http://downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
23+
# Strip protocol (http:// or https://) if present
24+
local site="${1#http://}"
25+
site="${site#https://}"
26+
# Strip trailing slash if present
27+
site="${site%/}"
28+
command curl -Ls "http://downforeveryoneorjustme.com/${site}" | command sed '/just you/!d;s/<[^>]*>//g'
2329
}
2430

2531
function myip() {

0 commit comments

Comments
 (0)