flysystem-stream-wrapper icon indicating copy to clipboard operation
flysystem-stream-wrapper copied to clipboard

stat()/file_exists() always returns on non-existent files with AWS adapter

Open tsmgeek opened this issue 4 years ago • 1 comments

When using stat()/file_exists() methods when backend is AWS v3 adapter you always get either true or stat results that are all 0.

If backend is local then these issues do not happen.

tsmgeek avatar Nov 19 '20 13:11 tsmgeek

https://github.com/twistor/flysystem-stream-wrapper/blob/master/src/Flysystem/Plugin/Stat.php#L117

Ok so I think the problem is twofold

  • if you get a literal FALSE back from getMetadata() it will normally mean it does not exist, the method itself does not throw exception
  • if you did a test for has() first you can check if it really exists before you do getMetadata()

The root stems from if you have 'disable_assert' enabled on the Filesystem.

tsmgeek avatar Nov 19 '20 19:11 tsmgeek