chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1466801 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultipartParser.java
Date Thu, 11 Apr 2013 08:59:24 GMT
Author: fmui
Date: Thu Apr 11 08:59:24 2013
New Revision: 1466801

URL: http://svn.apache.org/r1466801
Log:
Browser Binding server: if the web browser provides the full path of a document instead of
only the filename, extract the filename

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultipartParser.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultipartParser.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultipartParser.java?rev=1466801&r1=1466800&r2=1466801&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultipartParser.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultipartParser.java
Thu Apr 11 08:59:24 2013
@@ -425,6 +425,21 @@ public class MultipartParser {
 
             filename = params.get(MimeHelper.DISPOSITION_FILENAME);
 
+            if (filename != null) {
+                // if the browser sent the full path,
+                // extract the filename segment
+                int pathsep = filename.lastIndexOf('/');
+                if (pathsep > -1) {
+                    filename = filename.substring(pathsep + 1);
+                }
+                pathsep = filename.lastIndexOf('\\');
+                if (pathsep > -1) {
+                    filename = filename.substring(pathsep + 1);
+                }
+
+                filename = filename.trim();
+            }
+
             contentType = headers.get("content-type");
             if (contentType == null) {
                 contentType = Constants.MEDIATYPE_OCTETSTREAM;



Mime
View raw message