]> gitweb.ps.run Git - ps-gitweb/blobdiff - gitweb/gitweb.perl
fix regex
[ps-gitweb] / gitweb / gitweb.perl
index ed1dacdf682c115edbaeecf9269e5a7c9b975a2e..ca18cf48ca38b20033f77a4a26f713db540d58f6 100755 (executable)
@@ -82,6 +82,8 @@ sub evaluate_uri {
 # core git executable to use
 # this can just be "git" if your webserver has a sensible PATH
 our $GIT = "@GIT_BINDIR@/git";
+our $PERL = "perl";
+our $MD = "markdown";
 
 # absolute fs-path which will be prepended to the project path
 #our $projectroot = "/pub/scm";
@@ -7229,7 +7231,7 @@ sub get_markdown {
    my $thash = shift;
    my $rethtmlstr = "";
    use open ":encoding(utf8)"; # needed to have utf8 survive through the shell pipe
-   my $cmd_markdownify = $GIT . " " . git_cmd() . " cat-file blob " . $thash . " | perl -e 'my \$str = do { local \$/; <STDIN> }; \$str =~ s/<!--.*?--\s*>//gs; print \$str;' | markdown |";
+   my $cmd_markdownify = $GIT . " " . git_cmd() . " cat-file blob " . $thash . " | " . $PERL . " -e 'my \$str = do { local \$/; <STDIN> }; \$str =~ s/<!--.*?--\\s*>//gs; print \$str;' | " . $MD . " |";
    open (FOO, $cmd_markdownify) or die_error(500, "Open git-cat-file blob '$thash' failed");
    while (<FOO>) {
        if ($_ =~ /(<img[^>]src=")(.*?)"/) {
@@ -7257,7 +7259,7 @@ sub get_markdown {
                }
            }
        }
-       if ($_ =~ /(<a[^>]href=")(.*?)"/) {
+       if ($_ =~ /(<a[^>]href="[^\/])(.*?)"/) {
            my $origcut = "".$2;
            my $testcut = "".$2;
            my $is_anchor = ($testcut =~ /^#/);