Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15544

Using parameter tempFileName or tempPrefix with relative location in parent directory will fail

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Not A Bug
    • 3.5.0, 3.6.0
    • None
    • camel-ftp
    • None
    • Unknown

    Description

      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

      @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));
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            oklimberg Oliver Limberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: