Author: rombert Date: Thu Oct 9 22:05:24 2014 New Revision: 1630603 URL: http://svn.apache.org/r1630603 Log: SLING-4023 - Files with a colon in their names are imported with an incorrect name
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java?rev=1630603&r1=1630602&r2=1630603&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java (original) +++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java Thu Oct 9 22:05:24 2014 @@ -421,6 +421,35 @@ public class ContentImportTest { } + @Test + public void importFileWithNamespacedName() throws Exception { + + RepositoryAccessor repo = new RepositoryAccessor(config); + + // create faceted project + IProject contentProject = projectRule.getProject(); + + ProjectAdapter project = new ProjectAdapter(contentProject); + project.addNatures(JavaCore.NATURE_ID, "org.eclipse.wst.common.project.facet.core.nature"); + + // install bundle facet + project.installFacet("sling.content", "1.0"); + + wstServer.waitForServerToStart(); + + ServerAdapter server = new ServerAdapter(wstServer.getServer()); + server.installModule(contentProject); + + project.createVltFilterWithRoots("/content/test-root"); + project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/hello.txt"), + new ByteArrayInputStream("hello, world".getBytes())); + + repo.createFile("/content/test-root/sling:file", "some_content".getBytes()); + + runImport(contentProject); + + assertThat(contentProject, hasFile("jcr_root/content/test-root/_sling_file")); + } @Before public void setUp() throws Exception { Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java?rev=1630603&r1=1630602&r2=1630603&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java (original) +++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java Thu Oct 9 22:05:24 2014 @@ -392,7 +392,11 @@ public class ImportRepositoryContentActi */ private IPath getPathForPlainFileNode(ResourceProxy resource, IPath serializationFolderPath) { - return serializationFolderPath.removeLastSegments(1).append(Text.getName(resource.getPath())); + // TODO - can we just use the serializationFolderPath ? + + String name = serializationManager.getOsPath(Text.getName(resource.getPath())); + + return serializationFolderPath.removeLastSegments(1).append(name); } private void parseIgnoreFiles(IFolder folder, String path) throws IOException, CoreException {