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

can't detectSystemType for windows #1383

Closed
bblemm opened this issue Nov 23, 2021 · 1 comment
Closed

can't detectSystemType for windows #1383

bblemm opened this issue Nov 23, 2021 · 1 comment

Comments

@bblemm
Copy link

bblemm commented Nov 23, 2021

Bug Report

Q A
BC Break no
Version 1.1.5

Summary

The response from windows-ftp-server has a human readable format.
This contains padding whitespaces.

In function normalizeWindowsObject() is a trim used for this problem,
but in detectSystemType() is the item unfiltered used and the function returns always ‘unix’.

Finally, the item can’t be normalized because there are no 9 parts for unix format.

How to reproduce

Testable with windows server or with unit test, response has prefixed white spaces in meta data.

Test

tests/FtpTests.php
if (strpos($directory, 'file4.txt') !== false) { return [ ' 2016-05-23 12:09PM 684 file4.txt', ]; }

Fix

protected function detectSystemType($item) { return preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', trim($item)) ? 'windows' : 'unix'; }

bblemm added a commit to bblemm/flysystem that referenced this issue Nov 24, 2021
@frankdejonge
Copy link
Member

Supplied PR is merged and released as 1.1.7

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

2 participants