mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-6865 allow spaces in declare and file path
This commit is contained in:
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.action.dm;
|
package org.alfresco.module.org_alfresco_module_rm.action.dm;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -171,6 +173,8 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
|
|||||||
*/
|
*/
|
||||||
private NodeRef resolvePath(NodeRef filePlan, final String pathParameter)
|
private NodeRef resolvePath(NodeRef filePlan, final String pathParameter)
|
||||||
{
|
{
|
||||||
|
String decodedPathParameter = decode(pathParameter);
|
||||||
|
|
||||||
NodeRef destinationFolder;
|
NodeRef destinationFolder;
|
||||||
|
|
||||||
if (filePlan == null)
|
if (filePlan == null)
|
||||||
@@ -178,7 +182,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
|
|||||||
filePlan = getDefaultFilePlan();
|
filePlan = getDefaultFilePlan();
|
||||||
}
|
}
|
||||||
|
|
||||||
final String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true);
|
final String[] pathElementsArray = StringUtils.tokenizeToStringArray(decodedPathParameter, "/", false, true);
|
||||||
if ((pathElementsArray != null) && (pathElementsArray.length > 0))
|
if ((pathElementsArray != null) && (pathElementsArray.length > 0))
|
||||||
{
|
{
|
||||||
destinationFolder = resolvePath(filePlan, Arrays.asList(pathElementsArray));
|
destinationFolder = resolvePath(filePlan, Arrays.asList(pathElementsArray));
|
||||||
@@ -259,4 +263,24 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
return filePlan;
|
return filePlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to decode path string
|
||||||
|
*
|
||||||
|
* @param pathParameter The path string to be decoded
|
||||||
|
* @return The decoded path string
|
||||||
|
*/
|
||||||
|
private String decode(String pathParameter)
|
||||||
|
{
|
||||||
|
String decodedPathParameter;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
decodedPathParameter = URLDecoder.decode(pathParameter, "UTF-8");
|
||||||
|
}
|
||||||
|
catch (UnsupportedEncodingException ex)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the destination path could not be decoded.");
|
||||||
|
}
|
||||||
|
return decodedPathParameter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user