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 Aug 3, 2024
1 parent e184bef commit c8dcb14
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 c8dcb14

Please sign in to comment.