Skip to content

Commit ee639f5

Browse files
committed
GH-2350 Support underscore character in the not found page template
1 parent b482475 commit ee639f5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

reposilite-backend/src/main/kotlin/com/reposilite/frontend/NotFoundTemplate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import org.intellij.lang.annotations.Language
2121
object NotFoundTemplate {
2222

2323
private val uriFormatter = Regex("/+") // exclude common typos from URI
24-
private val regexAntiXss = Regex("[^A-Za-z0-9/.\\- ]") // exclude custom non-standard characters from template
24+
private val regexAntiXss = Regex("[^A-Za-z0-9/.\\-_ ]") // exclude custom non-standard characters from template
2525

2626
fun createNotFoundPage(basePath: String, originUri: String, details: String): String {
2727
val uri = originUri.replace(uriFormatter, "/")

reposilite-backend/src/test/kotlin/com/reposilite/storage/LocationTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class LocationTest {
3030
assertThat(Location.of("/group").resolve("/artifact").toString()).isEqualTo("group/artifact")
3131
assertThat(Location.of("/////group/////").resolve("/////artifact/////").toString()).isEqualTo("group/artifact")
3232
assertThat(Location.of("\\\\\\group\\\\\\").resolve("\\\\\\artifact\\\\\\").toString()).isEqualTo("group/artifact")
33+
assertThat(Location.of(".abc").resolve("_cdf.efg").toString()).isEqualTo(".abc/_cdf.efg")
3334
assertThat(Location.of("시험").resolve("기준").toString()).isEqualTo("시험/기준")
3435
}
3536

0 commit comments

Comments
 (0)