From 158f2746b8970c46748604e081bdf1fdd8fa9376 Mon Sep 17 00:00:00 2001
From: wxiaoguang <wxiaoguang@gmail.com>
Date: Wed, 27 Jul 2022 17:19:10 +0800
Subject: [PATCH] Fix ROOT_URL detection for URLs without trailing slash
 (#20502)

---
 web_src/js/features/common-global.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js
index 419c5996dc..3ce74442a0 100644
--- a/web_src/js/features/common-global.js
+++ b/web_src/js/features/common-global.js
@@ -389,7 +389,8 @@ export function initGlobalButtons() {
  */
 export function checkAppUrl() {
   const curUrl = window.location.href;
-  if (curUrl.startsWith(appUrl)) {
+  // some users visit "https://domain/gitea" while appUrl is "https://domain/gitea/", there should be no warning
+  if (curUrl.startsWith(appUrl) || `${curUrl}/` === appUrl) {
     return;
   }
   if (document.querySelector('.page-content.install')) {