Fix OASIS_AWS_LOCATION var#43
Merged
Merged
Conversation
put() override — effective_subdir = location + subdir is passed to super().put(), which stores the file at DirFS(bucket_name/root_dir)/location/subdir/file. Since root_dir is typically "", this means S3 key = location/subdir/file. The return value from super() is os.path.join(location, subdir, filename) — the full bucket-relative key — which is exactly what the server's is_in_bucket() and CopyObject(Key=...) need. get_storage_url() fix — same principle: the returned key includes the location prefix so the server stores a reference that the worker can later resolve. get() needs no change — DirFileSystem rooted at bucket_name accepts bucket-relative keys like oasis/file.txt directly. Both worker-side re-fetches and server-provided references (which may already carry the Django location prefix) work without stripping. root_dir / config_options unchanged — location and root_dir remain independent in storage config, so round-tripping is clean and existing deployments with location="" behave identically to before.
Ha-Ree
approved these changes
May 20, 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.
Fix the OASIS_AWS_LOCATION variable
Fixed the env
OASIS_AWS_LOCATION=<location-path>, when set objects should be stored inbucket/<location-path>/filenameput() override — effective_subdir = location + subdir is passed to super().put(), which stores the file at DirFS(bucket_name/root_dir)/location/subdir/file. Since root_dir is typically "", this means S3 key = location/subdir/file. The return value from super() is os.path.join(location, subdir, filename) — the full bucket-relative key — which is exactly what the server's is_in_bucket() and CopyObject(Key=...) need.
get_storage_url() fix — same principle: the returned key includes the location prefix so the server stores a reference that the worker can later resolve.
get() needs no change — DirFileSystem rooted at bucket_name accepts bucket-relative keys like oasis/file.txt directly. Both worker-side re-fetches and server-provided references (which may already carry the Django location prefix) work without stripping.
root_dir / config_options unchanged — location and root_dir remain independent in storage config, so round-tripping is clean and existing deployments with location="" behave identically to before.