~jan0sch/smederee

Showing details for patch 5fc565ef2efabae641fa76ca8e1754aa3ca82887.
2023-08-15 (Tue), 5:15 PM - Jens Grassel - 5fc565ef2efabae641fa76ca8e1754aa3ca82887

VCS: Fix unicode issues in the file browser.

- explicitly decode the path parts coming from the url

Fixes: https://tickets.smeder.ee/~jan0sch/smederee/tickets/4
Summary of changes
2 files modified with 2 lines added and 2 lines removed
  • modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala with 1 added and 1 removed lines
  • modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html with 1 added and 1 removed lines
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala	2025-01-15 12:36:33.123706441 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala	2025-01-15 12:36:33.127706444 +0000
@@ -478,7 +478,7 @@
                 darcsConfig.repositoriesDirectory.toPath.toString,
                 repositoryOwnerName.toString,
                 repositoryName.toString,
-                filePath.segments.mkString("/")
+                filePath.segments.map(_.decoded()).mkString("/")
               )
             )
           )
diff -rN -u old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html
--- old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html	2025-01-15 12:36:33.127706444 +0000
+++ new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryFiles.scala.html	2025-01-15 12:36:33.127706444 +0000
@@ -25,7 +25,7 @@
           <h2><a href="@{baseUri.addSegment(s"~${vcsRepository.owner.name}")}">~@vcsRepository.owner.name</a>/@vcsRepository.name</h2>
           @showRepositoryMenu(baseUri, linkToTicketService)(repositoryBaseUri.addSegment("files").some, vcsRepositoryBranches.size, repositoryBaseUri, user, vcsRepository)
           <div class="repo-summary-description">
-            <code>@{actionBaseUri.path.toString.replaceFirst("/files", "")}</code>
+            <code>@{actionBaseUri.path.segments.map(_.decoded()).mkString("/").replaceFirst("/files", "")}</code>
           </div>
         </div>
       </div>