Skip to content

Issue with putfo and relative paths #74

@wrvdklooster

Description

@wrvdklooster

I have an sftp server with the following directory structure:

/home/uploads

I have some code that uploads a file to this service using sftpretty as follows:

putfo(local_file, remotepath=uploads/uploadedfile.txt, confirm=True)

By default when connected I am in the /home directory.

With pysftp this used to work fine. With sftpretty behaviour changed it seems.

On one server this works fine. This server supports this:

debug2: Server supports extension "posix-rename@openssh.com" revision 1
debug2: Server supports extension "statvfs@openssh.com" revision 2
debug2: Server supports extension "fstatvfs@openssh.com" revision 2
debug2: Server supports extension "hardlink@openssh.com" revision 1
debug2: Server supports extension "fsync@openssh.com" revision 1
debug2: Server supports extension "lsetstat@openssh.com" revision 1
debug2: Server supports extension "limits@openssh.com" revision 1
debug2: Server supports extension "expand-path@openssh.com" revision 1
debug2: Server supports extension "copy-data" revision 1
debug2: Unrecognised server extension "home-directory"
debug2: Server supports extension "users-groups-by-id@openssh.com" revision 1

On another server this does not work. This server supports this:

debug2: Unrecognised server extension "versions"
debug2: Server supports extension "fsync@openssh.com" revision 1
debug2: Server supports extension "posix-rename@openssh.com" revision 1
debug2: Server supports extension "statvfs@openssh.com" revision 2
debug2: Server supports extension "fstatvfs@openssh.com" revision 2
debug2: Server supports extension "hardlink@openssh.com" revision 1
debug2: Unrecognised server extension "home-directory"

My guess would be the issue is with the missing expand-path@openssh.com support.

If I change the upload to using an absolute path it works fine on both:
putfo(local_file, remotepath=/home/uploads/uploadedfile.txt, confirm=True)

I am not sure if this is expected or if this is a bug.

The change I want to do on my side is to make the path absolute:

remote_path = self.client.normalize(remote_path)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions