aboutsummaryrefslogtreecommitdiff
path: root/lib/httracker/functions
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-04-19 23:17:51 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-04-19 23:17:51 -0300
commit26bac5bf981dde464ca0163d2ee325e632fe1dc4 (patch)
tree969cc439ca7501bef732955d64347a2a7290a304 /lib/httracker/functions
parentf0ffb8faef036be1ddec6d4a267212d7b7bd7893 (diff)
downloadhttruta-26bac5bf981dde464ca0163d2ee325e632fe1dc4.tar.gz
httruta-26bac5bf981dde464ca0163d2ee325e632fe1dc4.tar.bz2
Add PDF symlink if needed
Diffstat (limited to 'lib/httracker/functions')
-rw-r--r--lib/httracker/functions7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/httracker/functions b/lib/httracker/functions
index 7d3b4b5..c1bb689 100644
--- a/lib/httracker/functions
+++ b/lib/httracker/functions
@@ -66,6 +66,13 @@ function httracker_get {
rm -rf $TARGET
fi
+ # Add PDF symlink if needed
+ url_lower="$(echo "$url" | tr '[:upper:]' '[:lower:]')"
+ url_base="$(basename "$url")"
+ if [ "$(basename "$url_lower")" != "$(basename "$url_lower" .pdf)" ]; then
+ ( cd $TARGET && find -iname '*.pdf' -exec ln -s {} $url_base \; )
+ fi
+
# Save as PDF
if [ "$WKHTMLTOPDF" == "1" ] && which xvfb-run &> /dev/null && which wkhtmltopdf &> /dev/null; then
xvfb-run -a wkhtmltopdf "$url" $TARGET/screenshot.pdf