ghwikipp: make_new_page_version: output preview HTML with correct relative links.

From c3a288ed544e5742b5459e861dece43a62bbd076 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 14 May 2024 02:06:25 -0400
Subject: [PATCH] make_new_page_version: output preview HTML with correct
 relative links.

Fixes #54.

(Hopefully completely this time!)
---
 index.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/index.php b/index.php
index 491ad86..593cb94 100644
--- a/index.php
+++ b/index.php
@@ -815,7 +815,7 @@ function make_new_page_version($page, $ext, $newtext, $comment)
     }
 
     if ($trusted_author) {
-        print_template('pushed_to_main', [ 'hash' => $hash, 'commiturl' => "$github_url/commit/$hash", 'cooked' => $cooked ]);
+        print_template('pushed_to_main', [ 'hash' => $hash, 'commiturl' => "$github_url/commit/$hash", 'cooked' => fixup_preview_links($page, $cooked) ]);
     } else {  // generate a pull request so we can review before applying.
         $user = $_SESSION['github_user'];
         $body = "This edit was made by @{$user}.\n\n" .
@@ -830,7 +830,7 @@ function make_new_page_version($page, $ext, $newtext, $comment)
                                       'maintainer_can_modify' => true,
                                       'draft' => false ],
                                     $github_committer_token, true);
-        print_template('made_pull_request', [ 'branch' => $branch, 'prurl' => $response['html_url'], 'cooked' => $cooked ]);
+        print_template('made_pull_request', [ 'branch' => $branch, 'prurl' => $response['html_url'], 'cooked' => fixup_preview_links($page, $cooked) ]);
     }
 }