commit 97fd760e3e96973761141826e81d9fd1ba94d21d parent 3b93953c0ac0169dce37cf46e32f47a7c4addce3 Author: hhvn <dev@hhvn.uk> Date: Fri, 16 Jul 2021 23:11:21 +0100 .s/b/plumb: take mime-type only from code 200 Diffstat:
M | .scripts/bin/plumb | | | 7 | +++---- |
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/.scripts/bin/plumb b/.scripts/bin/plumb @@ -93,12 +93,11 @@ fetch(){ } mime(){ - mime=$($proxy curl -i "$(echo "$arg" | - sed -E 's/]|\[|}|\{/\\&/g')" | - awk '/^[[:space:]]*$/ {exit 1}; 1' | + mime=$($proxy curl -i "$(echo "$arg" | sed -E 's/]|\[|}|\{/\\&/g')" | + awk '/HTTP/ && $2 != "200" {s=1}; /^[[:space:]]*$/ {if (s) s=0; else exit 1}; !s' | tr '[:upper:]' '[:lower:]' | awk '$1 == "content-type:" {print $2}') - echo "$mime" | grep -i "$1" >/dev/null + echo "$mime" | tee /dev/stderr | grep -i "$1" >/dev/null } for arg in "$@"