fix: repair storage hot-path bugs and missing imports
- scripts.update_script: repoint script.current_object_id to the newly uploaded StorageObject and best-effort delete the old working copy. Previously the old row was mutated with the new content_hash while the script still pointed at it, silently losing user edits on the next publish_version. - scripts.publish_version: read object bytes via the new RustFSObjectStore.get_bytes() instead of the non-existent .get_object(); publish 500'd on every call. - scripts.upload_script / storage_api.complete_upload_record: Path(file_name) raised NameError (only PurePosixPath imported), crashing every upload and every upload finalization. Use PurePosixPath. - RustFSObjectStore: add get_bytes() helper (sync, body.close in finally) for in-process callers that need raw bytes. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -137,6 +137,14 @@ class RustFSObjectStore:
|
||||
def head(self, *, bucket_name: str, object_key: str) -> dict[str, Any]:
|
||||
return self.internal.head_object(Bucket=bucket_name, Key=object_key)
|
||||
|
||||
def get_bytes(self, *, bucket_name: str, object_key: str) -> bytes:
|
||||
response = self.internal.get_object(Bucket=bucket_name, Key=object_key)
|
||||
body: BinaryIO = response["Body"]
|
||||
try:
|
||||
return body.read()
|
||||
finally:
|
||||
body.close()
|
||||
|
||||
def sha256(self, *, bucket_name: str, object_key: str) -> str:
|
||||
response = self.internal.get_object(Bucket=bucket_name, Key=object_key)
|
||||
body: BinaryIO = response["Body"]
|
||||
|
||||
Reference in New Issue
Block a user