Skip to content

Commit

Permalink
Replace – with - in urls
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarvelle committed Nov 20, 2024
1 parent ee7f4a7 commit 03b34f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/no/ndla/taxonomy/util/PrettyUrlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private static String cleanString(String name) {
.replaceAll("æ", "a")
.replaceAll("ø", "o")
.replaceAll("å", "a")
.replaceAll("–", "-")
.trim();
}

Expand Down
4 changes: 4 additions & 0 deletions src/test/java/no/ndla/taxonomy/util/PrettyUrlUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ void test_create_pretty_url_with_punctuation() {
"/r/this-is-a-title-and-a-12/hash",
PrettyUrlUtil.createPrettyUrl(Optional.empty(), "This is a title and a 1/2", "hash", NodeType.RESOURCE)
.get());
assertEquals(
"/r/this-is-a-title---with-long-dash/hash",
PrettyUrlUtil.createPrettyUrl(Optional.empty(), "This is a title – with long dash", "hash", NodeType.RESOURCE)
.get());
}

@Test
Expand Down

0 comments on commit 03b34f0

Please sign in to comment.