]> source.dussan.org Git - gitea.git/commitdiff
Fix ROOT_URL detection for URLs without trailing slash (#20503)
authorwxiaoguang <wxiaoguang@gmail.com>
Wed, 27 Jul 2022 15:49:01 +0000 (23:49 +0800)
committerGitHub <noreply@github.com>
Wed, 27 Jul 2022 15:49:01 +0000 (23:49 +0800)
web_src/js/features/common-global.js

index 419c5996dc651b45740186a509812947dc4f09ab..3ce74442a0ca13bd9556cc81e4b11845e331c79a 100644 (file)
@@ -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')) {