Skip to content

Commit

Permalink
fix: Escape dependency jar lock file's name (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
warnyul committed Jul 31, 2024
1 parent a67deaf commit 807224c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ internal class JUnit5MavenDependencyResolver private constructor(
}

private fun createLockFile(dependencyJar: DependencyJar): File {
return File(System.getProperty("user.home"), "${dependencyJar.shortName}.lock")
val lockFileName = dependencyJar.shortName.replace(SPECIAL_CHARACTERS_IN_FILE_NAME_REGEX.toRegex(), "_")
return File(System.getProperty("user.home"), "$lockFileName.lock")
}

@Suppress("NestedBlockDepth")
Expand All @@ -83,4 +84,8 @@ internal class JUnit5MavenDependencyResolver private constructor(
lockFile.delete()
}
}

private companion object {
private const val SPECIAL_CHARACTERS_IN_FILE_NAME_REGEX = """[<>:"\\/|\?\*]"""
}
}

0 comments on commit 807224c

Please sign in to comment.