devopshq / devopshq/artifactory

`path` property of a `GenericRepository` seems to be a malformed `ArtifactoryPath` object

Open
#386 0 comments 0 reactions 0 assignees View on GitHub
Bug hacktoberfest
Dominant language
Python
Stars
306
Forks
161
PR merge metrics
No merged PRs in 30d

Description

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:

```python
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:

```python
cn = ArtifactoryPath(str(cr.path))

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

cn.parts
# ('http://localhost:123...ctory/abc/',)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.