You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Oliver Limberg (Jira)" <ji...@apache.org> on 2020/09/17 14:23:00 UTC

[jira] [Created] (CAMEL-15544) Using parameter tempFileName or tempPrefix with relative location in parent directory will fail

Oliver Limberg created CAMEL-15544:
--------------------------------------

             Summary: Using parameter tempFileName or tempPrefix with relative location in parent directory will fail
                 Key: CAMEL-15544
                 URL: https://issues.apache.org/jira/browse/CAMEL-15544
             Project: Camel
          Issue Type: Improvement
          Components: camel-ftp
    Affects Versions: 3.5.0, 3.6.0
            Reporter: Oliver Limberg


When using either parameter tempFileName or tempPrefix with a relative path, the component will not create the final target directory and moving/renaming the file from the temp location will fail.

Both tests below will fail when placing them in FtpProducerTempPrefixTest
{code:java}
@Test
public void testWriteUsingRelativeTempPrefix() throws Exception {
    sendFile("ftp://admin@localhost:" + getPort() + "/upload/user/claus?binary=false&password=admin" + "&tempPrefix=../tmp/tmp_", "Hello World", "claus.txt");

    Thread.sleep(500);

    File file = new File(FTP_ROOT_DIR + "/upload/user/claus/claus.txt");
    assertTrue(file.exists(), "The uploaded file should exists");
    assertEquals("Hello World", IOConverter.toString(file, null));
}

@Test
public void testWriteUsingRelativeTempFileName() throws Exception {
    sendFile("ftp://admin@localhost:" + getPort() + "/upload/user/claus?binary=false&password=admin" + "&tempFileName=../tmp/${file:name.noext}.tmp", "Hello World", "claus.txt");

    Thread.sleep(500);

    File file = new File(FTP_ROOT_DIR + "/upload/user/claus/claus.txt");
    assertTrue(file.exists(), "The uploaded file should exists");
    assertEquals("Hello World", IOConverter.toString(file, null));
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)