[java-identity-provider] branch main updated: Account for symlinks in module resource paths.

Scott Cantor cantor.2 at osu.edu
Mon Mar 8 17:59:22 UTC 2021


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=facdbb3fcadccf06e70556b06c9f41f50130b912

The following commit(s) were added to refs/heads/main by this push:
       new  facdbb3fc Account for symlinks in module resource paths.
facdbb3fc is described below

commit facdbb3fcadccf06e70556b06c9f41f50130b912
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Mar 8 12:59:19 2021 -0500

    Account for symlinks in module resource paths.
---
 .../java/net/shibboleth/idp/module/AbstractIdPModule.java     | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java b/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java
index abfabb638..0c9ae78f6 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.nio.file.FileAlreadyExistsException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
@@ -438,7 +439,15 @@ public abstract class AbstractIdPModule implements IdPModule {
                     throw new ModuleException("Module asked to create file outside of IdP installation");
                 }
 
-                Files.createDirectories(destPath.getParent());
+                try {
+                    Files.createDirectories(destPath.getParent());
+                } catch (final IOException e) {
+                    if (e instanceof FileAlreadyExistsException) {
+                        log.info("Path {} existed but not directory, assuming symlink", destPath.getParent());
+                    } else {
+                        throw e;
+                    }
+                }
                 Files.copy(srcStream, destPath, StandardCopyOption.REPLACE_EXISTING);
                 if (isExecutable()) {
                     destPath.toFile().setExecutable(true);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list