You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2013/04/11 10:59:24 UTC
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
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;