]> source.dussan.org Git - gitea.git/commitdiff
Fix escape problems in the branch selector (#25875)
authoryp05327 <576951401@qq.com>
Fri, 21 Jul 2023 06:18:40 +0000 (15:18 +0900)
committerGitHub <noreply@github.com>
Fri, 21 Jul 2023 06:18:40 +0000 (06:18 +0000)
Fix #25865

web_src/js/components/RepoBranchTagSelector.vue

index 5d085752783cd48ba869652cedbc030feb9ec440..4fc393624469de0e0a141355d0197494aba4025a 100644 (file)
@@ -108,7 +108,7 @@ const sfc = {
       return this.items.filter((item) => item.name.toLowerCase() === this.searchTerm.toLowerCase()).length === 0;
     },
     formActionUrl() {
-      return `${this.repoLink}/branches/_new/${pathEscapeSegments(this.branchNameSubURL)}`;
+      return `${this.repoLink}/branches/_new/${this.branchNameSubURL}`;
     },
   },
 
@@ -274,15 +274,15 @@ export function initRepoBranchTagSelector(selector) {
 
     if (data.showBranchesInDropdown && data.branches) {
       for (const branch of data.branches) {
-        data.items.push({name: branch, url: branch, branch: true, tag: false, selected: branch === data.defaultBranch});
+        data.items.push({name: branch, url: pathEscapeSegments(branch), branch: true, tag: false, selected: branch === data.defaultBranch});
       }
     }
     if (!data.noTag && data.tags) {
       for (const tag of data.tags) {
         if (data.release) {
-          data.items.push({name: tag, url: tag, branch: false, tag: true, selected: tag === data.release.tagName});
+          data.items.push({name: tag, url: pathEscapeSegments(tag), branch: false, tag: true, selected: tag === data.release.tagName});
         } else {
-          data.items.push({name: tag, url: tag, branch: false, tag: true, selected: tag === data.defaultBranch});
+          data.items.push({name: tag, url: pathEscapeSegments(tag), branch: false, tag: true, selected: tag === data.defaultBranch});
         }
       }
     }