fix: support short-format URIs in VikingURI and VikingFS access control#402
Merged
MaojiaSheng merged 2 commits intovolcengine:mainfrom Mar 4, 2026
Merged
Conversation
VikingURI now auto-normalizes short-format URIs ('/resources', 'user/memories')
to full format ('viking://resources', 'viking://user/memories') via the existing
normalize() static method. This eliminates ValueError when constructing VikingURI
with short paths.
VikingFS._is_accessible() now normalizes URIs before checking, preventing
false PermissionError('Access denied') for short-format paths.
Changes:
- openviking_cli/utils/uri.py: VikingURI.__init__ calls self.normalize(uri)
- openviking/storage/viking_fs.py: _is_accessible normalizes non-viking:// URIs
- tests/unit/test_uri_short_format.py: 19 tests covering normalization
Fixes #259
|
|
1 task
MaojiaSheng
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix
VikingURIandVikingFS._is_accessible()to accept short-format URI paths (e.g.,/resources,user/memories) in addition to full-format URIs (viking://resources).Related Issue
Fixes #259
Root Cause
Two issues prevented short-format URIs from working:
VikingURI.__init__required URIs to start withviking://, raisingValueErrorfor short paths like/resourcesVikingFS._is_accessible()returnedFalse(access denied) for any URI not starting withviking://, which triggeredPermissionErrorbefore_uri_to_pathcould normalize the pathChanges Made
openviking_cli/utils/uri.pyVikingURI.__init__now auto-normalizes via the existingnormalize()static methodopenviking/storage/viking_fs.py_is_accessible()normalizes non-viking://URIs instead of rejecting themtests/unit/test_uri_short_format.pyDesign Decisions
normalize()method: TheVikingURI.normalize()static method already handled the conversion correctly — the fix simply wires it into the constructornormalize()unchanged (idempotent)VikingURI("/invalid_scope/foo")still raisesValueError— only the format requirement is relaxedTesting
All 19 new tests pass. No existing tests affected.
Type of Change
Checklist