Comments (8)
BTW you're probably getting different behavior on macOS versus Linux because the two have different versions of urllib3. urllib3's URL parser is used with the context of an HTTP client so it optimizes for sending over the wire, not parsing URLs and passing them to application contexts (ie doesn't do the hex decoding)
from artifactory.
%
in file name breaks both Mac and Linux. These characters are important for Debian packages such as libgcc1_1%3a8.3.0-6ubuntu1~18.04.1_amd64.deb
from artifactory.
relative_to
function may be related https://github.com/devopshq/artifactory/blob/develop/artifactory.py#L759
from artifactory.
Found the problem with %
on drv = part.split(url.path)[0]
url.path
comes from urllib3.util.parse_url()
which calls urllib3.util._encode_invalid_chars()
which has IMO a bug that changes all percent-encoded bytes to upper case
# Normalize existing percent-encoded bytes.
for enc in percent_encodings:
if not enc.isupper():
component = component.replace(enc, enc.upper())
This modifies the URL's casing, and part-shuffling fails.
Opened an issue urllib3.util._encode_invalid_chars() changes the percent-encoded bytes to upper case #1677
from artifactory.
Same rc is also causing URLs with ~
to fail. During drv = part.split(url.path)[0]
, url.path
is url-encoded while part is not.
387 -> drv = part.split(url.path)[0]
388 path_parts = url.path.strip(sep).split(sep)
389 root = sep + path_parts[0] + sep
390 rest = sep.join(path_parts[1:])
391 return drv, root, rest
(Pdb) url.path
'/something/something/containerd.io_1.2.0%7Erc.0-1_amd64.deb'
(Pdb) part
'https://domain.com/something/something/containerd.io_1.2.0~rc.0-1_amd64.deb'
In order for drv = part.split(url.path)[0]
to work, either part
must be encoded or url.path
must be decoded.
Now, there seems to be a fight online about whether tilde should be encoded or not. I guess Linux version of urllib3 encodes it whereas Mac version of urllib3 does not? Since the dependent packages are yielding inconsistent results, I think ArtifactoryPath should program defensively and expect either cases.
from artifactory.
Welp that was fast. The issue i opened was closed within 8 hours as a "feature not a bug". Regardless, I think ArtifactoryPath should keep the original casing of percent-encoded bytes because otherwise the copy flat out fails mysteriously. A lowercase hex after an @
is a valid file name after all.
from artifactory.
Not sure what the best way to unquote the URL is. I'm writing something like
def _get_path(part, path):
if path in part:
return path
unquoted_path = urllib3.parse.unquote(path)
if unquoted_path in part:
return unquoted_path
else:
raise ValueError(f"{part} does not include {path}")
but it seems that urllib3
does not have parse.unquote()
which its counterpart urllib
does. It seems silly to import urllib
just to call unquote. Thinking...
from artifactory.
ubuntu 16.04 - All work correctly
>>> from artifactory import ArtifactoryPath
>>> target = ArtifactoryPath("https://artfactory/repo/tmp", auth=('user', 'password'))
>>> target.deploy_file('file~with~tilde')
>>> origin = ArtifactoryPath("https://artfactory/repo/tmp/file~with~tilde", auth=('user', 'password'))
>>> target = ArtifactoryPath("https://artfactory/repo/tmp/file~with~tilde2", auth=('user', 'password'))
>>> origin.copy(target)
>>> target_two = ArtifactoryPath("https://artfactory/repo/tmp/file~with~tilde~two", auth=('user', 'password'))
>>> origin.copy(target_two)
from artifactory.
Related Issues (20)
- `requests` dependency is unversioned, but at least 2.26.0 is not supported HOT 3
- dohq-artifactory doesn't work with Python 3.11.2 HOT 11
- path.stat() doesn't handle ArtifactoryPath() properly HOT 2
- Unable to walk HOT 1
- Unit tests failing with `IncompleteRead` HOT 1
- Listing directory too slow HOT 1
- Download archive not working? HOT 2
- ArtifactoryPath.glob() doesn't support case in the patern
- Python 3.12 - AttributeError: module 'pathlib' has no attribute '_Flavour' HOT 19
- Unable to manage group's users on Artifactory SaaS
- ArtifactoryPath.glob() failing on Python versions >= 3.11.4 HOT 11
- Patterns for PermissionTarget HOT 1
- WSL `FileNotFoundError: [Errno 2] No such file or directory: 'https://binrepo.xxxx.net/artifactory/publish/publish-prod/'` HOT 5
- ArtifactoryException: File not found HOT 1
- Remove relative_to function HOT 3
- Add support for the new Access Token API
- Including http_error as attribute in exception HOT 8
- Calling `ArtifactoryPath.aql()` does not respect the timeout passed to path
- Copy fails with AttributeError: 'str' object has no attribute 'drive' HOT 1
- No support for Python3.12 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from artifactory.