-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Currently, images (and other assets) referenced by relative URLs fail to load properly, making embedded images broken links in the preview.
I believe that if we set the base to point to the PR's raw files, this problem goes away.
<base href="https://raw.githubusercontent.com/[user]/[repo]/[commit]/">Where the user, repo, and commit point to that particular PR (which I got by inspecting the URLs in the files tab of the PR page).
If I manually add this base in the source, it works. Of course, it's crazy making to put details about the PR into the content of the fork itself (you have to create the PR, then update the fork), but it proved that a good <base> element could solve the problem.
It may be that this is ALWAYS the right approach (base SHOULD be the PR), but at a minimum, I'd like a way to turn it on in a config file if it isn't a good default for some reason.
Can anyone point me to the code where this might be handled? Happy to try a PR, but I'm new to the code base.
I note that it also worked as
<base href="https://raw.githubusercontent.com/[user]/[repo]/[branch]">When using the incoming fork's user and repo. As a hack, that makes it a bit easier for the PR creator as they can just refer to the right branch in their fork, without needing to know about any particular PR. Unfortunately, it would mean that the PR preview is always looking at the current branch, which may not be correct historically. You could view an old, closed PR, and get the wrong view of the asset. Linking to the PR's commit doesn't have that problem.
This seems like it would be a generally useful improvement.
Thoughts?