Merged 5.2.N (5.2.1) to HEAD (5.2)

129608 mmuller: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
      129597 mmuller: Merged 5.0.N (5.0.5) to 5.1.N (5.1.2) (PARTIAL MERGE)
         129593 mmuller: Merged 5.0.4 (5.0.4) to 5.0.N (5.0.5)
            129585 mmuller: Merged 5.0.3 (5.0.3.9) to 5.0.4 (5.0.4)
               129514 mmuller: MNT-16380, REPO-927, ESC-469 Regression fix from 4.2 --> 5.0. Can now use relative paths again.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129876 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2016-08-25 10:39:50 +00:00
parent 421751d17f
commit b0fe463739
2 changed files with 118 additions and 100 deletions

View File

@@ -428,14 +428,30 @@ public class StreamContent extends AbstractWebScript
{
this.ref = new NodeRef(nodeRef);
}
ObjectReference(StoreRef ref, String id)
{
if (id.indexOf('/') != -1)
String[] relativePath = id.split("/");
// bug fix MNT-16380
// for using a relative path to a node id eg. 18cc-.../folder1/.../folderN/fileA.txt
// if only one slash we don't have a relative path
if (relativePath.length <= 2)
{
id = id.substring(0, id.indexOf('/'));
if (id.indexOf('/') != -1)
{
id = id.substring(0, id.indexOf('/'));
}
this.ref = new NodeRef(ref, id);
}
else
{
String[] reference = new String[relativePath.length + 2];
reference[0] = ref.getProtocol();
reference[1] = ref.getIdentifier();
System.arraycopy(relativePath, 0, reference, 2, relativePath.length);
this.ref = repository.findNodeRef("node", reference);
}
this.ref = new NodeRef(ref, id);
}
ObjectReference(StoreRef ref, String[] path)