瀏覽代碼

fix mkdirs bug in data-service war

Jason Rivard 4 年之前
父節點
當前提交
a12c2ab121
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      data-service/src/main/java/password/pwm/receiver/Storage.java

+ 9 - 0
data-service/src/main/java/password/pwm/receiver/Storage.java

@@ -216,6 +216,15 @@ public class Storage
 
     static void mkdirs( final File file ) throws IOException
     {
+        if ( file.exists() )
+        {
+            if ( file.isDirectory() )
+            {
+                return;
+            }
+            throw new IOException( "path already exists as file: " + file.getAbsolutePath() );
+        }
+
         if ( !file.mkdirs() )
         {
             throw new IOException( "unable to create path " + file.getAbsolutePath() );