hirochachacha / go-smb2

SMB2/3 client library written in Go.
BSD 2-Clause "Simplified" License
350 stars 94 forks source link

test: filepath.Match consistency #54

Closed oliverpool closed 2 years ago

oliverpool commented 2 years ago

Hi,

I looked at your glob branch, and I think that it is quite complex.

I was able to find an edge case: escaped brackets will be matched by the regex (but should not be).

I have added a test to reproduce (all the strings that match a given pattern should also match against the simplified pattern).

hirochachacha commented 2 years ago

escape pattern cannot be supported on windows and smb, because '\' is native path separator for both systems.

hirochachacha commented 2 years ago

https://pkg.go.dev/path/filepath#Match

On Windows, escaping is disabled. Instead, '\' is treated as path separator.

hirochachacha commented 2 years ago

oh, nevermind. I misinterpreted your comment.

hirochachacha commented 2 years ago

sorry, I'm confused. are you saying that it should pass the test or not? I think it should not pass the test because we cannot support escape syntax for smb.

oliverpool commented 2 years ago

On Windows, escaping is disabled. Instead, '\' is treated as path separator.

I missed that, so you are right, the \ can be ignored (on linux as well?)