Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Root folder is not created when missing (sftp) #1832

Open
ionutantohi opened this issue Nov 22, 2024 · 0 comments
Open

Root folder is not created when missing (sftp) #1832

ionutantohi opened this issue Nov 22, 2024 · 0 comments

Comments

@ionutantohi
Copy link

ionutantohi commented Nov 22, 2024

Bug Report

Q A
Flysystem Version 3.29.1
Adapter Name SftpAdapter
Adapter version 3.29.0

Summary

Root folder is not created when is missing and UnableToWriteFile exception is thrown

Note: It is created though if the path contains a prefix.

How to reproduce

use League\Flysystem\Config;
use League\Flysystem\PhpseclibV3\SftpAdapter;
use League\Flysystem\PhpseclibV3\SftpConnectionProvider;

$provider = SftpConnectionProvider::fromArray([
    'driver' => 'sftp',
    'host' => 'domain',
    'username' => 'username',
    'password' => 'password',
]);


$adapter = new SftpAdapter(
    connectionProvider: $provider,
    root: 'uploads'
);

// Make sure that "uploads" folder is missing on remote server before each test

// ❌ Case 1: UnableToWriteFile exception is thrown
// I expect to work and file to be uploaded at /uploads/file.txt
$adapter->write('file.txt', 'content', new Config());


// ✅ Case 2: File is uploaded at /uploads/parent_folder/file.txt even if the "uploads" folder doesn't exist
$adapter->write('parent_folder/file.txt', 'content', new Config());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant