You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The logic in modules/markup/markdown's (*Renderer).Image is inaccessible to external renderers. Relative image URLs pass through unchanged and wrong.
I can think of two solutions:
Expose urlPrefix to the process as an environment variable, such as GITEA_PREFIX_SRC=https://github.com/user/repo/raw/branch/master/subdir/ and GITEA_PREFIX_RAW=/user/repo/raw/branch/master/subdir/. Then you can at least wrap external tools in scripts; asciidoctor just needs to have the imagesdir attribute set appropriately.
Change all relative image srcs in a PostProcess step to point to a /raw/ location because they are pointless anyway (a brute force solution would be to use <base href=> in the header template).
The text was updated successfully, but these errors were encountered:
Slight generalization of my workaround for nginx, works only for a project's root README:
# Circumventing Gitea issue #5031
# Must not catch POST /user/login, that is an awful surprise
set $redirectable 1;
if ($request_method !~ ^(HEAD|GET)$) {
set $redirectable 0;
}
if ($request_uri !~ ^(/[^/]+/[^/]+)$) {
set $redirectable 0;
}
if ($redirectable) {
return 301 https://$host$request_uri/;
}
#!/bin/sh
external-markup-renderer-invocation | perl -pe '
# The URL must end with a slash; since <script> does not
# come through, I had to resolve that in nginx.conf
s,(<img src=")([^/]*?"),$1raw/branch/master/$2,g'
I noticed this too (when using Pandoc as markdown parser) and was just about to open an issue about this.
I would prefer the approach using an environment variable, as this would be more flexible. If there are no objections and I get around to it, I'll try to make a PR doing that.
[x]
):Description
The logic in modules/markup/markdown's
(*Renderer).Image
is inaccessible to external renderers. Relative image URLs pass through unchanged and wrong.I can think of two solutions:
urlPrefix
to the process as an environment variable, such asGITEA_PREFIX_SRC=https://github.com/user/repo/raw/branch/master/subdir/
andGITEA_PREFIX_RAW=/user/repo/raw/branch/master/subdir/
. Then you can at least wrap external tools in scripts; asciidoctor just needs to have theimagesdir
attribute set appropriately.src
s in aPostProcess
step to point to a/raw/
location because they are pointless anyway (a brute force solution would be to use<base href=>
in the header template).The text was updated successfully, but these errors were encountered: