From 20fc9751df2b6577e83f789db871fe71608fb8bf Mon Sep 17 00:00:00 2001 From: mka Date: Mon, 8 Apr 2013 08:48:46 +0000 Subject: [PATCH] Upload operation is improved(Files that name contains the special symbols(ex, &) can also be uploaded now) --- .../Siman/src/org/splat/simer/UploadAction.java | 16 ++++++++++++++++ Workspace/Siman/src/struts.xml | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Workspace/Siman/src/org/splat/simer/UploadAction.java b/Workspace/Siman/src/org/splat/simer/UploadAction.java index a5548dd..1814bce 100644 --- a/Workspace/Siman/src/org/splat/simer/UploadAction.java +++ b/Workspace/Siman/src/org/splat/simer/UploadAction.java @@ -1,6 +1,8 @@ package org.splat.simer; import java.io.File; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import org.splat.kernel.Do; import org.splat.service.technical.RepositoryService; @@ -162,6 +164,20 @@ public class UploadAction extends Action { return _uploadFileName; } + /** + * Get fileName with url special symbols canceled for usage in struts.xml. + * @return + */ + public String getCanceledFileName() { + String res = _uploadFileName; + try { + res = URLEncoder.encode(res, "UTF-8"); + } catch (UnsupportedEncodingException e) { + LOG.error("Reason: ", e); + } + return res; + } + /** * Get the action to which the uploaded file is passed. * diff --git a/Workspace/Siman/src/struts.xml b/Workspace/Siman/src/struts.xml index 1c31962..8d6c00d 100644 --- a/Workspace/Siman/src/struts.xml +++ b/Workspace/Siman/src/struts.xml @@ -490,13 +490,13 @@ step-study - import-document?fileName=%{fileName} + import-document?fileName=%{canceledFileName} - version-document?index=%{index}&fileName=%{fileName} + version-document?index=%{index}&fileName=%{canceledFileName} - attach-document?index=%{index}&fileName=%{fileName} + attach-document?index=%{index}&fileName=%{canceledFileName} page.error.study -- 2.39.2