Author: bdelacretaz
Date: Thu Feb  7 03:00:34 2008
New Revision: 619360

URL: http://svn.apache.org/viewvc?rev=619360&view=rev
Log:
SLING-235 - UjaxFileUploadHandler now creates an nt:file if the name of the 
file to upload contains an extension

Modified:
    
incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxFileUploadHandler.java

Modified: 
incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxFileUploadHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxFileUploadHandler.java?rev=619360&r1=619359&r2=619360&view=diff
==============================================================================
--- 
incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxFileUploadHandler.java
 (original)
+++ 
incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxFileUploadHandler.java
 Thu Feb  7 03:00:34 2008
@@ -79,6 +79,7 @@
     public static final String NT_FOLDER = "nt:folder";
     public static final String NT_FILE = "nt:file";
     public static final String NT_RESOURCE = "nt:resource";
+    public static final String NT_UNSTRUCTURED = "nt:unstructured";
 
     // item name string constants
     public static final String JCR_CONTENT = "jcr:content";
@@ -144,6 +145,13 @@
                 // assuming type not valid.
                 typeHint = null;
             }
+        }
+        
+        // also create an nt:file if the name contains an extension
+        // the rationale is that if the file name is "important" we want
+        // an nt:file, and an image name with an extension is probably 
"important"
+        if(!createNtFile && name.indexOf('.') > 0) {
+            createNtFile = true;
         }
 
         // set empty type


Reply via email to