From 624cd22f389ab1b0be23d74bab54479d0e0a855d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 25 May 2023 12:59:48 +0200 Subject: [PATCH] Fix problem displaying images in RST preview --- sphinx/README.md | 2 +- sphinx/sphinx_to_html.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sphinx/README.md b/sphinx/README.md index 4bcd44e..fabcfee 100644 --- a/sphinx/README.md +++ b/sphinx/README.md @@ -16,7 +16,7 @@ Add to Gitea app.ini. [markup.restructuredtext] ENABLED = true FILE_EXTENSIONS = .rst - RENDER_COMMAND = timeout 30s sudo -u sphinx ./custom/sphinx/venv/bin/python3 ./custom/sphinx/sphinx_to_html.py + RENDER_COMMAND = timeout 30s sudo --preserve-env=GITEA_PREFIX_SRC -u sphinx ./custom/sphinx/venv/bin/python3 ./custom/sphinx/sphinx_to_html.py [markup.sanitizer.restructuredtext] ELEMENT = div diff --git a/sphinx/sphinx_to_html.py b/sphinx/sphinx_to_html.py index 8e0f981..f293a7e 100755 --- a/sphinx/sphinx_to_html.py +++ b/sphinx/sphinx_to_html.py @@ -13,6 +13,7 @@ import tempfile page_contents = sys.stdin.read() base_url = "https://projects.blender.org" +uatest_base_url = "https://uatest.projects.blender.org" local_url = "http://localhost:3000" placeholder_url = "https://placeholder.org" @@ -20,6 +21,8 @@ placeholder_url = "https://placeholder.org" gitea_prefix = os.environ.get("GITEA_PREFIX_SRC", "") if gitea_prefix.startswith(base_url): gitea_prefix = gitea_prefix[len(base_url):] +if gitea_prefix.startswith(uatest_base_url): + gitea_prefix = gitea_prefix[len(uatest_base_url):] if gitea_prefix.startswith(local_url): gitea_prefix = gitea_prefix[len(local_url):]