diff --git a/model-server/src/main/kotlin/org/modelix/model/server/handlers/RepositoryOverview.kt b/model-server/src/main/kotlin/org/modelix/model/server/handlers/RepositoryOverview.kt
index 4626977bf9..d225d0c1ef 100644
--- a/model-server/src/main/kotlin/org/modelix/model/server/handlers/RepositoryOverview.kt
+++ b/model-server/src/main/kotlin/org/modelix/model/server/handlers/RepositoryOverview.kt
@@ -83,18 +83,10 @@ class RepositoryOverview(private val repoManager: RepositoriesManager) {
buildHistoryLink(branch.repositoryId.id, branch.branchName)
}
td {
- a("../content/$repository/${branch.branchName}/latest/") {
- +"Explore Latest Version"
- }
+ buildExploreLatestLink(branch.repositoryId.id, branch.branchName)
}
td {
- form {
- postButton {
- name = "delete"
- formAction = "../v2/repositories/${branch.repositoryId.id}/delete"
- +"Delete Repository"
- }
- }
+ buildDeleteForm(branch.repositoryId.id)
}
}
}
@@ -111,3 +103,19 @@ fun FlowOrInteractiveOrPhrasingContent.buildHistoryLink(repositoryId: String, br
+"Show History"
}
}
+
+fun FlowOrInteractiveOrPhrasingContent.buildExploreLatestLink(repositoryId: String, branchName: String) {
+ a("../content/${repositoryId.encodeURLPathPart()}/${branchName.encodeURLPathPart()}/latest/") {
+ +"Explore Latest Version"
+ }
+}
+
+fun FlowContent.buildDeleteForm(repositoryId: String) {
+ form {
+ postButton {
+ name = "delete"
+ formAction = "../v2/repositories/${repositoryId.encodeURLPathPart()}/delete"
+ +"Delete Repository"
+ }
+ }
+}
diff --git a/model-server/src/test/kotlin/org/modelix/model/server/handlers/RepositoryOverviewTest.kt b/model-server/src/test/kotlin/org/modelix/model/server/handlers/RepositoryOverviewTest.kt
index 8b286f0ae0..9960dcbd7a 100644
--- a/model-server/src/test/kotlin/org/modelix/model/server/handlers/RepositoryOverviewTest.kt
+++ b/model-server/src/test/kotlin/org/modelix/model/server/handlers/RepositoryOverviewTest.kt
@@ -25,9 +25,22 @@ class RepositoryOverviewTest {
@Test
fun testSlashesInPathSegmentsFromRepositoryIdAndBranchId() {
- val html = createHTML().span {
+ val html = createHTML(prettyPrint = false).span {
buildHistoryLink("repository/v1", "branch/v2")
+ buildExploreLatestLink("repository/v1", "branch/v2")
+ buildDeleteForm("repository/v1")
}
- assertEquals("Show History", html)
+ assertEquals(
+ """
+
+ Show History
+ Explore Latest Version
+
+
+ """.lines().joinToString("") { it.trim() },
+ html,
+ )
}
}