Skip to content

Commit b02eff2

Browse files
committed
Canonicalize parent path in LibraryAdder.findResources in case JENKINS_HOME is a symlink
1 parent 87a7d92 commit b02eff2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/jenkinsci/plugins/workflow/libs/LibraryAdder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static List<URL> retrieve(@NonNull LibraryRecord record, @NonNull LibraryRetriev
256256
for (LibraryRecord library : action.getLibraries()) {
257257
FilePath libResources = libs.child(library.getDirectoryName() + "/resources/");
258258
FilePath f = libResources.child(name);
259-
if (!new File(f.getRemote()).getCanonicalFile().toPath().startsWith(libResources.absolutize().getRemote())) {
259+
if (!new File(f.getRemote()).getCanonicalFile().toPath().startsWith(new File(libResources.getRemote()).getCanonicalPath())) {
260260
throw new AbortException(name + " references a file that is not contained within the library: " + library.name);
261261
} else if (f.exists()) {
262262
resources.put(library.name, readResource(f, encoding));

0 commit comments

Comments
 (0)