From 1b3f13b1ba5a3e40d4c9266f16091ad347aec333 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Mon, 25 Jan 2021 19:30:21 +0100 Subject: sfeed_update: shuffle code getting the path of the feedurl to make the basesiteurl Move it closer before it is used. --- sfeed_update | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sfeed_update b/sfeed_update index d975518..96f1111 100755 --- a/sfeed_update +++ b/sfeed_update @@ -94,12 +94,6 @@ feed() { basesiteurl="$3" encoding="$4" - # if baseurl is empty then use the path from the feed by default. - if [ "${basesiteurl}" = "" ]; then - host="${feedurl##*://}" - basesiteurl="${feedurl%%://*}://${host%/*}/" - fi - filename="$(printf '%s' "${name}" | tr '/' '_')" sfeedfile="${sfeedpath}/${filename}" tmpfeedfile="${sfeedtmpdir}/${filename}" @@ -121,6 +115,12 @@ feed() { fi rm -f "${tmpfeedfile}.fetch" + # if baseurl is empty then use the path from the feed by default. + if [ "${basesiteurl}" = "" ]; then + host="${feedurl##*://}" + basesiteurl="${feedurl%%://*}://${host%/*}/" + fi + if ! parse "${name}" "${feedurl}" "${basesiteurl}" < "${tmpfeedfile}.utf8" > "${tmpfeedfile}.tsv"; then log "${name}" "FAIL (PARSE)" return -- cgit v1.2.3