mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
57061: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 56549: Merged V4.1-BUG-FIX (4.1.7) to V4.2-BUG-FIX (4.2.1) 55942: Merged DEV to V4.1-BUG-FIX (4.1.7) 52177: MNT-8884: URL of the "View in CIFS" link is not URL encoded - Utils.java was updated. Fix does URL encoding for CIFS link except a link that will be displayed in IE. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61694 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -67,6 +67,7 @@ import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.DownloadContentServlet;
|
||||
@@ -476,13 +477,38 @@ public final class Utils extends StringUtils
|
||||
NodeRef rootNode = contentCtx.getRootNode();
|
||||
try
|
||||
{
|
||||
url = Repository.getNamePathEx(context, node.getNodePath(), rootNode, "\\",
|
||||
"file:///" + navBean.getCIFSServerPath(diskShare));
|
||||
if (!EqualsHelper.nullSafeEquals(rootNode, node.getNodeRef()))
|
||||
{
|
||||
String userAgent = Utils.getUserAgent(context);
|
||||
final boolean isIE = Utils.USER_AGENT_MSIE.equals(userAgent);
|
||||
|
||||
if (isIE)
|
||||
{
|
||||
url = Repository.getNamePathEx(context, node.getNodePath(), rootNode, "\\", "file:///" + navBean.getCIFSServerPath(diskShare));
|
||||
}
|
||||
else
|
||||
{
|
||||
// build up the CIFS url
|
||||
StringBuilder path = new StringBuilder("file:///").append(navBean.getCIFSServerPath(diskShare));
|
||||
List<FileInfo> paths = fileFolderService.getNamePath(rootNode, node.getNodeRef());
|
||||
|
||||
// build up the path skipping the first path as it is the root folder
|
||||
for (int x = 0; x < paths.size(); x++)
|
||||
{
|
||||
path.append("\\").append(WebDAVHelper.encodeURL(paths.get(x).getName(), userAgent));
|
||||
}
|
||||
url = path.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (AccessDeniedException e)
|
||||
{
|
||||
// cannot build path if user don't have access all the way up
|
||||
}
|
||||
catch (FileNotFoundException nodeErr)
|
||||
{
|
||||
// cannot build path if file no longer exists
|
||||
}
|
||||
catch (InvalidNodeRefException nodeErr)
|
||||
{
|
||||
// cannot build path if node no longer exists
|
||||
|
Reference in New Issue
Block a user