From 2ba57dc141d29fc564890488e536b35ce20bda3a Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Mon, 1 Apr 2019 15:32:29 +0200 Subject: [PATCH] small code improvement --- scm-ui/src/repos/modules/branches.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scm-ui/src/repos/modules/branches.js b/scm-ui/src/repos/modules/branches.js index 8397ac3011..62299801d6 100644 --- a/scm-ui/src/repos/modules/branches.js +++ b/scm-ui/src/repos/modules/branches.js @@ -27,10 +27,11 @@ export const FETCH_BRANCH_FAILURE = `${FETCH_BRANCH}_${FAILURE_SUFFIX}`; // Fetching branches export function fetchBranchByName(link: string, name: string) { - const branchUrl = link.endsWith("/") - ? link + encodeURIComponent(name) - : link + "/" + encodeURIComponent(name); - return fetchBranch(branchUrl, name); + let endsWith = ""; + if(!link.endsWith("/")) { + endsWith = "/"; + } + return fetchBranch(link + endsWith + encodeURIComponent(name), name); } export function fetchBranchPending(name: string): Action {