You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/09/02 15:58:00 UTC

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

     [ https://issues.apache.org/jira/browse/CAMEL-15544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-15544.
---------------------------------
    Resolution: Not A Bug

> 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
>            Priority: Major
>
> 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.20.10#820010)