fix(repository): make sure to not double url encode branch ref
+ 11
- 11
@@ -1,5 +1,5 @@
 {
-  "_generatedAtUnix": 1665685521848,
+  "_generatedAtUnix": 1665696751297,
   "_hashAlgorithm": "sha1",
   "_version": 2,
   "islands": {

...
@@ -70,7 +70,7 @@
       "pathSourceMap": "./public/.islands/RepositoryPullRequestCreateForm.bundle.js.map"
     },
     "RepositoryTreeView": {
-      "hash": "730ce2e7a8f5b705deb6fac8e506ebc0d4cc1458",
+      "hash": "d67f8f95e142fb6593b07fa08e1e5580ecc8eedf",
       "pathSource": "./app/islands/RepositoryTreeView.tsx",
       "pathBundle": "./public/.islands/RepositoryTreeView.bundle.js",
       "pathSourceMap": "./public/.islands/RepositoryTreeView.bundle.js.map"

...
@@ -114,7 +114,7 @@
       "pathSource": "./app/views/repository/RepositoryCreateView.tsx"
     },
     "RepositoryDetailsView": {
-      "hash": "486e106dcc7ef2a7499b9702b9dd81ce3cf90b6d",
+      "hash": "c3e752ad6bdd246ee4e462912df47e6cca5e6a78",
       "pathSource": "./app/views/repository/RepositoryDetailsView.tsx"
     },
     "RepositoryExploreView": {

app/controllers/repository/getRepositoryBrowserView.ts
@@ -21,7 +21,7 @@ const getRepositoryBrowserView: ReqHandler = async (request, reply) => {
   const params =
     request.params as AppRoutesParams[AppRoute.REPOSITORY_BROWSER]["params"];
   const { orgSlug, repoSlug, currentRef: currRef } = params;
-  const path = params["*"];
+  const path = params["*"] || "";
   const currentRef = currRef || Const.DEFAULT_HEAD_REF;
 
   const orgService = makeOrganizationService({ request });

app/islands/RepositoryTreeView.tsx
@@ -46,13 +46,13 @@ const RepositoryTreeView: ReactIsland<
             ? buildRouteLink(AppRoute.REPOSITORY_BROWSER_WITH_PATH, {
                 orgSlug,
                 repoSlug,
-                currentRef: encodeURIComponent(currentRef),
+                currentRef,
                 "*": fileName,
               })
             : buildRouteLink(AppRoute.REPOSITORY_BROWSER_WITH_PATH, {
                 orgSlug,
                 repoSlug,
-                currentRef: encodeURIComponent(currentRef),
+                currentRef,
                 "*": `${
                   currentPath.endsWith("/") || currentPath === ""
                     ? currentPath

...
@@ -79,7 +79,7 @@ const RepositoryTreeView: ReactIsland<
       : buildRouteLink(AppRoute.REPOSITORY_BROWSER_WITH_PATH, {
           orgSlug,
           repoSlug,
-          currentRef: encodeURIComponent(currentRef),
+          currentRef,
           "*": prevPath.endsWith("/") ? prevPath : `${prevPath}/`,
         });
 

...
@@ -113,7 +113,7 @@ const RepositoryTreeView: ReactIsland<
                       {
                         orgSlug,
                         repoSlug,
-                        currentRef: encodeURIComponent(currentRef),
+                        currentRef,
                         "*": `${currPathParts.slice(0, idx + 1).join("/")}/`,
                       }
                     )}

...
@@ -129,7 +129,7 @@ const RepositoryTreeView: ReactIsland<
               href={buildRouteLink(AppRoute.REPOSITORY_COMMITS_LOG, {
                 orgSlug,
                 repoSlug,
-                currentRef: encodeURIComponent(currentRef),
+                currentRef,
               })}
             >
               Commits History

@@ -18,10 +18,10 @@ import {
 } from "./controllers";
 
 const RootAppRouter: AppRouter = () => {
+  const loggedOrLoginRedirect = authenticatedOrLogin();
   const guestOrDashboardRedirect = guestOrRedirect(
     AppRoutePaths[AppRoute.USER_DASHBOARD]
   );
-  const loggedOrLoginRedirect = authenticatedOrLogin();
 
   return (
     <Router.Root>

app/views/repository/RepositoryDetailsView.tsx
@@ -240,7 +240,7 @@ const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
                           href={buildRouteLink(AppRoute.REPOSITORY_BROWSER, {
                             orgSlug: parentOrg.slug,
                             repoSlug: repo.slug,
-                            currentRef: encodeURIComponent(branch),
+                            currentRef: branch,
                             "*":
                               path != null && path.trim() !== "" && path !== "/"
                                 ? path