Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
hangc0276 committed Mar 4, 2024
1 parent 81b6ef0 commit ac15d54
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,11 @@ private static LocalBookKeeper getLocalBookiesInternal(ServerConfiguration conf,
* @throws IOException
*/
private void serializeLocalBookieConfig(ServerConfiguration localBookieConfig, String fileName) throws IOException {
if (StringUtils.isBlank(fileName) || !fileName.endsWith(".conf")) {
throw new IllegalArgumentException("File name should end with .conf");
if (StringUtils.isBlank(fileName)
|| fileName.contains("..")
|| fileName.contains("/")
|| fileName.contains("\\")) {
throw new IllegalArgumentException("Invalid filename: " + fileName);
}

File localBookieConfFile = new File(localBookiesConfigDir, fileName);
Expand Down

0 comments on commit ac15d54

Please sign in to comment.