-
Notifications
You must be signed in to change notification settings - Fork 831
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
Check Symlink #203
Comments
I'm having this bug as well... A symbolic link directory is returned as "type = file" when I use the listContents method. Would be nice to retrieve it as "type = link" so I can do something else with it. |
@wateengoedidee hi, the concept of links is not supported by a large number of adapters. Is there a way to check to what type the symlink links? |
Perhaps readlink? http://php.net/manual/en/function.readlink.php But this is only necessary for the FTP adapter? |
@wateengoedidee that function of only good for the local FS, not for ftp though. I'll do some research on this. |
;) |
@FrenkyNet Thanks for looking into this. We are using flysystem to retrieve files over FTP and back them up to S3. Looping over the listContents fails, since the name of a symlink is "name -> destination" and type = "file", which results in an "incorrect file". |
@FrenkyNet Did you find some time to look into this? I hope it's possible, thanks. |
@24creative unfortunately I haven't yet. There's no PHP function to follow the link, which would be needed to check the type. I'm working at a client at the moment (freelance) so it's a bit tough to get time free to dive into this. If you come across anything remotely helpful I'll gladly read through it. |
I haven't found a way to deal with this. Closing this due because we're unable to support this across all adapters. When a solution is found, a PR would be very welcome. I'll add notes about links not being supported for now. |
@FrenkyNet There's no PHP function to follow the link, but we don't need to know where the link leads to, we only need to know if it is a symlink so that we can ignore it or do other stuff with it. A link now shows as a regular file with the listContents method. Isn't this possible? If not then it's a bummer. Thanks again for looking into this. |
@24creative in the response the FTP function give, instead of the file or dir, you get link. No other type is specified. In other worlds there's no way you'd know how to handle this even when detecting it. I've also tried looking up ways to use the FTP command flags in order to follow links and such. The problem here lies more with the protocol even. Links seem to be bolted on the initial implementation and had to conform to an output standard which didn't allow for a more detailed response. |
@24creative I would be open to a PR which just flat out ignores them though. That's the only thing you can reliably do. |
Really could do with a way to work around symlinks, for both Local and FTP adapters.. |
Hi There,
Just made a quick fix to check whether the type is 'dir, file or link (symlink)'
In the file
\League\Flysystem\Adapter\AbstractFtpAdapter.php link 262 I added:
Now you can check if there is a symbolic link so that the read() method doesn't get any errors. ;)
The text was updated successfully, but these errors were encountered: