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/BRANCHES/DEV/5.2.N/root@129608 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Martin Muller
2016-08-17 19:46:25 +00:00
parent ca933ce831
commit de1ba8f23b
2 changed files with 118 additions and 100 deletions

View File

@@ -431,11 +431,27 @@ public class StreamContent extends AbstractWebScript
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)

View File

@@ -62,6 +62,7 @@ import org.alfresco.repo.web.scripts.thumbnail.ThumbnailServiceTest;
import org.alfresco.repo.web.scripts.transfer.TransferWebScriptTest;
import org.alfresco.repo.web.scripts.workflow.ActivitiWorkflowRestApiTest;
import org.alfresco.repo.web.scripts.workflow.WorkflowModelBuilderTest;
import org.alfresco.repo.web.scripts.content.ContentGetTest;
/**
* Web Scripts test suite
@@ -109,6 +110,7 @@ public class WebScriptTestSuite extends TestSuite
suite.addTestSuite( FacetRestApiTest.class );
suite.addTestSuite( CommentsApiTest.class );
suite.addTestSuite( DeclarativeSpreadsheetWebScriptTest.class );
suite.addTestSuite( ContentGetTest.class);
suite.addTestSuite( XssVulnerabilityTest.class );
suite.addTestSuite( LinksRestApiTest.class );
suite.addTestSuite( RemoteFileFolderLoaderTest.class );