Skip to content

Commit

Permalink
Merge pull request #140 from yjx0003/139-error-loading-course-names-w…
Browse files Browse the repository at this point in the history
…ith-wrong-characters-in-the-file-system

Fix #139
  • Loading branch information
rmartico authored Jul 26, 2024
2 parents 260bdff + 3393200 commit d66a1c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/es/ubu/lsi/ubumonitor/util/UtilMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public static <T> String joinWithQuotes(List<T> list) {
* @param stringToRemove need to remove reserved character
* @return without reserved character
*/
public static String removeReservedChar(String stringToRemove) {
String newString = stringToRemove.replaceAll(":|\\\\|/|\\?|\\*|\\|", "");
public static String removeReservedChar(String stringToRemove) {
String newString = stringToRemove.replaceAll("\"|\\||<|>|:|\\\\|/|\\?|\\*|\\|", ""); // FIX #139 added more dangerous characters
return newString.trim();

}
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/es/ubu/lsi/ubumonitor/UnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public void removeBackSlashTest() {
fillMap(map, "Inglés EPS VENA-curso 2019:20", "Inglés EPS VENA-curso 201920");
fillMap(map, "Inglés EPS\\ VENA-curso 2019:20", "Inglés EPS VENA-curso 201920");
fillMap(map, "Inglés EPS ?VENA-curso 2019:20", "Inglés EPS VENA-curso 201920");
fillMap(map, "Inglés EPS \"VENA-curso 2019:20\"", "Inglés EPS VENA-curso 201920");
fillMap(map, "Inglés EPS <VENA-curso 2019:20>", "Inglés EPS VENA-curso 201920");
fillMap(map, "Inglés EPS |VENA-curso 2019:20|", "Inglés EPS VENA-curso 201920");
for (Map.Entry<String, String> entry : map.entrySet()) {
assertEquals(entry.getValue(), entry.getKey());
}
Expand Down

0 comments on commit d66a1c0

Please sign in to comment.