Skip to content

Commit 8b0cff6

Browse files
authored
sanitize paths should be allowed to place something in the same pwd (#99)
problem: currently extracting to the PWD does not work because sanitize paths is expecting the extraction to always be in a subdirectory. Solution: allow them to be the same. Signed-off-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: vsoch <vsoch@users.noreply.github.com>
1 parent 0f331fb commit 8b0cff6

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ and **Merged pull requests**. Critical items to know are:
1414
The versions coincide with releases on pip. Only major versions will be released as tags on Github.
1515

1616
## [0.0.x](https://github.com/oras-project/oras-py/tree/main) (0.0.x)
17-
- Ensure insecure is passed to provider class (0.1.20)
18-
- patch fix for blob upload Windows, closes issue [93](https://github.com/oras-project/oras-py/issues/93) (0.1.19)
19-
- patch fix for empty manifest config on Windows, closes issue [90](https://github.com/oras-project/oras-py/issues/90) (0.1.18)
20-
- patch fix to correct session url pattern, closes issue [78](https://github.com/oras-project/oras-py/issues/78) (0.1.17)
21-
- add support for tag deletion and retry decorators (0.1.16)
17+
- Allow to pull exactly to PWD (0.1.21)
18+
- Ensure insecure is passed to provider class (0.1.20)
19+
- patch fix for blob upload Windows, closes issue [93](https://github.com/oras-project/oras-py/issues/93) (0.1.19)
20+
- patch fix for empty manifest config on Windows, closes issue [90](https://github.com/oras-project/oras-py/issues/90) (0.1.18)
21+
- patch fix to correct session url pattern, closes issue [78](https://github.com/oras-project/oras-py/issues/78) (0.1.17)
22+
- add support for tag deletion and retry decorators (0.1.16)
2223
- bugfix that pagination sets upper limit of 10K (0.1.15)
2324
- pagination for tags (and general function for pagination) (0.1.14)
2425
- expose upload_blob function to be consistent (0.1.13)

oras/utils/fileio.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def sanitize_path(expected_dir, path):
4343
It can be directly there or a child, but not outside it.
4444
We raise an error if it does not - this should not happen
4545
"""
46+
# It's OK to pull to PWD exactly
47+
if os.path.abspath(expected_dir) == os.path.abspath(path):
48+
return os.path.abspath(expected_dir)
4649
base_dir = pathlib.Path(expected_dir)
4750
test_path = (base_dir / path).resolve()
4851
if not base_dir.resolve() in test_path.resolve().parents:

oras/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
__copyright__ = "Copyright The ORAS Authors."
33
__license__ = "Apache-2.0"
44

5-
__version__ = "0.1.20"
5+
__version__ = "0.1.21"
66
AUTHOR = "Vanessa Sochat"
77
EMAIL = "vsoch@users.noreply.github.com"
88
NAME = "oras"

0 commit comments

Comments
 (0)