devopshq / artifactory

dohq-artifactory: a Python client for Artifactory
https://devopshq.github.io/artifactory/
MIT License
269 stars 137 forks source link

ArtifactoryPath.glob() doesn't support case in the patern #428

Open dogbert911 opened 11 months ago

dogbert911 commented 11 months ago

I have artifacts with capitalize and non-capitalize names. When I'm using glob to search artifacts with capitalize names, it returns all of them. But I expect only capitalized.

Example:

# My artifactory:
# /aaa/file_1.txt
# /aaa/file_2.txt
# /aaa/FILE_3.txt

for p in ArtifactoryPath('aaa').glob('FILE*'):
    print(p)
# Real Out:
# /aaa/file_1.txt
# /aaa/file_2.txt
# /aaa/FILE_3.txt
#
# My expectation:
# /aaa/FILE_3.txt

It happens because compile_pattern function contain next code:

re.compile(fnmatch.translate(pattern), re.IGNORECASE)

to fix it should be next:

- re.compile(fnmatch.translate(pattern), re.IGNORECASE)
+ re.compile(fnmatch.translate(pattern))