Skip to content
Permalink
Browse files
Avoid potentially moving folders across volume boundaries
Reviewed-by: ehelin
  • Loading branch information
rwestberg committed Oct 5, 2020
1 parent 4678f1a commit 3a8e3170019b9a98b67cfe53801cdb024359f219
Showing with 1 addition and 9 deletions.
  1. +1 −9 forge/src/main/java/org/openjdk/skara/forge/HostedRepositoryPool.java
@@ -79,16 +79,8 @@ private Repository cloneSeeded(Path path) throws IOException {
}

private void removeOldClone(Path path, String reason) {
if (!Files.exists(seed)) {
try {
Files.createDirectories(seed.getParent());
} catch (IOException e) {
log.severe("Failed to create seed parent folder: " + seed.getParent());
log.throwing("HostedRepositoryInstance", "preserveOldClone", e);
}
}
if (Files.exists(path)) {
var preserved = seed.resolveSibling(seed.getFileName().toString() + "-" + reason + "-" + UUID.randomUUID());
var preserved = path.resolveSibling(seed.getFileName().toString() + "-" + reason + "-" + UUID.randomUUID());
log.severe("Invalid local repository detected (" + reason + ") - preserved in: " + preserved);
try {
Files.move(path, preserved);

1 comment on commit 3a8e317

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 3a8e317 Oct 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.