source: link back to resulting page
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 17 May 2017 23:36:40 +0000 (01:36 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 29 May 2017 17:29:34 +0000 (19:29 +0200)
common.inc.plp
source.plp

index 6672bd5010f66ba09b84c809729cf0b3c1e28606..5f7cb25f394046b8963f5b9b85d6292ba0f0f55a 100644 (file)
@@ -180,6 +180,7 @@ EOT
 sub showlink {
        my ($title, $href, $selected) = @_;
        return sprintf(
 sub showlink {
        my ($title, $href, $selected) = @_;
        return sprintf(
+               !$href ? '%s' :
                $selected ? '<strong>%s</strong>' : '<a href="%2$s">%s</a>',
                EscapeHTML($title), EscapeHTML($href)
        );
                $selected ? '<strong>%s</strong>' : '<a href="%2$s">%s</a>',
                EscapeHTML($title), EscapeHTML($href)
        );
index 931b3dc90556aba1f6a6a28c682a4d8274e8574c..ea856281b6fde8acfc871bf12228f52a18a85101 100644 (file)
@@ -54,7 +54,8 @@ if (not $source) {
        say "</ul>\n";
 }
 else {
        say "</ul>\n";
 }
 else {
-       say "<h1>Source of $source</h1>";
+       my $href = showlink($source, $source =~ m{\A (\w+) \.plp \z}x && "/$1");
+       say "<h1>Source of $href</h1>";
 
        if ($source =~ m{(?:/|^)\.}) {
                die "File request not permitted\n";
 
        if ($source =~ m{(?:/|^)\.}) {
                die "File request not permitted\n";