From 0d6e5af8d71e9ec92abd61c17d254554dc83ec46 Mon Sep 17 00:00:00 2001 From: Yasumichi Akahoshi Date: Sun, 7 Dec 2025 01:26:37 +0900 Subject: [PATCH] Tentative fix for issue #2456 (#3883) Co-authored-by: Naoki Takezoe --- src/main/scala/gitbucket/core/view/Markdown.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/view/Markdown.scala b/src/main/scala/gitbucket/core/view/Markdown.scala index 9db2a950f..772f1abbf 100644 --- a/src/main/scala/gitbucket/core/view/Markdown.scala +++ b/src/main/scala/gitbucket/core/view/Markdown.scala @@ -192,7 +192,13 @@ object Markdown { .stripSuffix(".git") + "/blob/" + branch + "/" + urlWithRawParam } } else { - repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/_blob/" + url + // URL is being modified to link to the image file on the repository, but users may want to link to the page if the page name is a link. + // As a interim solution, if the link contains a ., it will use the current conversion, otherwise it will perform the conversion the user wants. + if (url.lastIndexOf(".") > 0) { + repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/_blob/" + url + } else { + repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/" + url + } } } }