Skip to content

Inconsistent behaviour between listing and downloading the files. #9123

Closed
@SimoneGiusso

Description

@SimoneGiusso

In what version(s) of Spring Integration are you seeing this issue?

6.2.4

Describe the bug

/ at the beginning of the remote dir path is not necessary when listing files although it is necessary to download them

To Reproduce

    @Test
    fun testFileDownload() {
        sftpTemplate.list("remote-dir").forEach { // All the files under remote-dir are listed
            log.info { it.filename }
        }

        log.info { "---- FINISHED TO LIST DIRECTORIES -----\n\n\n\n" }

        sftpTemplate.get("/remote-dir/MyFile.csv") { // remote-dir/MyFile.csv won't work
            inputStream -> inputStream.use {
                localDir.mkdir()
                FileUtils.copyInputStreamToFile(inputStream, File(localDir.absolutePath + "test.csv"))
        }}
    }

Expected behavior

sftpTemplate.get should work also with "remote-dir/MyFile.csv" as input.

See also stackOverflow question.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions