mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-20 07:22:32 +00:00
[FIXED JENKINS-21958] FilePath.copyRecursiveTo given a scanner including a symlink but not any regular file in the same directory would neglect to create the parent directory on the destination and thus not copy the link.
(Util.createSymlink is partly to blame for not throwing a descriptive IOException when it fails to create a link, but this is its historical behavior needed for compatibility. copyRecursiveTo also continues to suppress error text from this method because there is nowhere for it to go. Perhaps need a new variant of createSymlink that is guaranteed to either have created the link or throw an exception.)
This commit is contained in:
1 parent
7b42017522
commit
7c568178f3
3 files changed
+44
-6
No files matched your search
@@ -1933,7 +1933,7 @@ public final class FilePath implements Serializable {
|
||||
@Override public void visit(File f, String relativePath) throws IOException {
|
||||
if (f.isFile()) {
|
||||
File target = new File(dest, relativePath);
|
||||
target.getParentFile().mkdirs();
|
||||
IOUtils.mkdirs(target.getParentFile());
|
||||
Util.copyFile(f, target);
|
||||
count.incrementAndGet();
|
||||
}
|
||||
@@ -1943,6 +1943,7 @@ public final class FilePath implements Serializable {
|
||||
}
|
||||
@Override public void visitSymlink(File link, String target, String relativePath) throws IOException {
|
||||
try {
|
||||
IOUtils.mkdirs(new File(dest, relativePath).getParentFile());
|
||||
Util.createSymlink(dest, target, relativePath, TaskListener.NULL);
|
||||
} catch (InterruptedException x) {
|
||||
throw (IOException) new IOException(x.toString()).initCause(x);
|
||||
|
||||
Reference in new issue
Block a user