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

path property of a GenericRepository seems to be a malformed ArtifactoryPath object #386

Open
briantist opened this issue Oct 9, 2022 · 0 comments

Comments

@briantist
Copy link
Contributor

The path property of a repository object is an ArtifactioryPath to the repository.
The str representation of this object is correct, but it seems like the parts property is missing the repository itself.

This ends up being confusing because while it looks correct as a string or repr, many other methods use the parts, for example if you used this to construct a new ArtifactoryPath.

I will try to demonstrate with some sample code:

ca = ArtifactoryPath('http://localhost:12345/artifactory')
cr = RepositoryLocal(ca, name='abc', package_type=RepositoryLocal.GENERIC)

cr.path
# ArtifactoryPath('http://localhost:12345/artifactory/abc/')

cr.parts
# ('http://localhost:123...rtifactory',)

cr.path.parts
# ('http://localhost:123...rtifactory',)

cp = ArtifactoryPath(cr.path)

cp
# ArtifactoryPath('http://localhost:12345/artifactory')

cp.parts
# ('http://localhost:123...rtifactory',)

cs = cr.path / 'subfolder'

cs
# ArtifactoryPath('http://localhost:12345/artifactory/abc/subfolder')

cs.parts
# ('http://localhost:123...rtifactory', 'subfolder')

We can workaround this by casting to str and back to a path object:

cn = ArtifactoryPath(str(cr.path))

cn
# ArtifactoryPath('http://localhost:12345/artifactory/abc/')

cn.parts
# ('http://localhost:123...ctory/abc/',)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants