Skip to content

Commit

Permalink
Added more legal characters for NameUtils.toValidEntryName(String).
Browse files Browse the repository at this point in the history
  • Loading branch information
MTrop committed Mar 13, 2024
1 parent e3900ff commit f98af1f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Doom Struct (C) 2015-2024
by Matt Tropiano et al. (see AUTHORS.txt)


Changed in 2.15.7
-----------------

- `Changed` Added more legal characters for `NameUtils.toValidEntryName(String)`.


Changed in 2.15.6
-----------------

Expand Down
26 changes: 25 additions & 1 deletion src/main/java/net/mtrop/doom/util/NameUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static byte[] toASCIIBytes(String s, int bytelen)
* Tests if an input string is a valid entry name.
* <p>
* A WadEntry must have a name that is up to 8 characters long, and can only contain
* A-Z (uppercase only), 0-9, and [ ] - _, and +, plus the backslash ("\").
* A-Z (uppercase only), 0-9, and most symbols plus the backslash ("\").
* @param name the input name to test.
* @return true if so, false if not.
*/
Expand Down Expand Up @@ -122,6 +122,30 @@ else if (c == '\\')
sb.append(c);
else if (c == '^')
sb.append(c);
else if (c == '@')
sb.append(c);
else if (c == '#')
sb.append(c);
else if (c == '%')
sb.append(c);
else if (c == '&')
sb.append(c);
else if (c == '=')
sb.append(c);
else if (c == '{')
sb.append(c);
else if (c == '}')
sb.append(c);
else if (c == '(')
sb.append(c);
else if (c == ')')
sb.append(c);
else if (c == '$')
sb.append(c);
else if (c == '*')
sb.append(c);
else if (c == '!')
sb.append(c);
else
sb.append('-');
}
Expand Down

0 comments on commit f98af1f

Please sign in to comment.