diff --git a/src/main/java/no/ndla/taxonomy/util/PrettyUrlUtil.java b/src/main/java/no/ndla/taxonomy/util/PrettyUrlUtil.java index 102478d2..8d56e96e 100644 --- a/src/main/java/no/ndla/taxonomy/util/PrettyUrlUtil.java +++ b/src/main/java/no/ndla/taxonomy/util/PrettyUrlUtil.java @@ -69,6 +69,7 @@ private static String cleanString(String name) { .replaceAll("æ", "a") .replaceAll("ø", "o") .replaceAll("å", "a") + .replaceAll("–", "-") .trim(); } diff --git a/src/test/java/no/ndla/taxonomy/util/PrettyUrlUtilTest.java b/src/test/java/no/ndla/taxonomy/util/PrettyUrlUtilTest.java index 8ebceb6e..0ab20fa9 100644 --- a/src/test/java/no/ndla/taxonomy/util/PrettyUrlUtilTest.java +++ b/src/test/java/no/ndla/taxonomy/util/PrettyUrlUtilTest.java @@ -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