diff --git a/config/alfresco/web-scripts-application-context.xml b/config/alfresco/web-scripts-application-context.xml index 22a4c9244e..d36b9b0690 100644 --- a/config/alfresco/web-scripts-application-context.xml +++ b/config/alfresco/web-scripts-application-context.xml @@ -103,26 +103,21 @@ - + Repository - - - - - - - - + + + + + - - diff --git a/source/java/org/alfresco/repo/web/scripts/RepoStore.java b/source/java/org/alfresco/repo/web/scripts/RepoStore.java index 0fc8818e62..16e85056e8 100644 --- a/source/java/org/alfresco/repo/web/scripts/RepoStore.java +++ b/source/java/org/alfresco/repo/web/scripts/RepoStore.java @@ -84,8 +84,7 @@ public class RepoStore implements Store, TenantDeployer protected FileFolderService fileService; protected NamespaceService namespaceService; protected PermissionService permissionService; - - private TenantDeployerService tenantDeployerService; + protected TenantDeployerService tenantDeployerService; /** @@ -310,11 +309,11 @@ public class RepoStore implements Store, TenantDeployer int baseDirLength = getBaseDir().length() +1; List documentPaths = new ArrayList(); String scriptPath = script.getDescription().getScriptPath(); - NodeRef scriptNodeRef = findNodeRef(scriptPath); + NodeRef scriptNodeRef = (scriptPath.length() == 0) ? getBaseNodeRef() : findNodeRef(scriptPath); if (scriptNodeRef != null) { org.alfresco.service.cmr.repository.Path repoScriptPath = nodeService.getPath(scriptNodeRef); - String id = script.getDescription().getId().substring(script.getDescription().getScriptPath().length() +1); + String id = script.getDescription().getId().substring(scriptPath.length() + (scriptPath.length() > 0 ? 1 : 0)); String query = "+PATH:\"" + repoScriptPath.toPrefixString(namespaceService) + "//*\" +QNAME:" + id + "*"; ResultSet resultSet = searchService.query(repoStore, SearchService.LANGUAGE_LUCENE, query); List nodes = resultSet.getNodeRefs(); @@ -436,7 +435,15 @@ public class RepoStore implements Store, TenantDeployer List folderElementsList = Arrays.asList(folderElements); // create folder - FileInfo pathInfo = fileService.makeFolders(getBaseNodeRef(), folderElementsList, ContentModel.TYPE_FOLDER); + FileInfo pathInfo; + if (folderElementsList.size() == 0) + { + pathInfo = fileService.getFileInfo(getBaseNodeRef()); + } + else + { + pathInfo = fileService.makeFolders(getBaseNodeRef(), folderElementsList, ContentModel.TYPE_FOLDER); + } // create file String fileName = pathElements[pathElements.length -1];