Skip to content

Commit 470d1c7

Browse files
committed
🐛 Fix archive file was not closed after upload
1 parent 24c4b26 commit 470d1c7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/fastapi_cloud_cli/commands/deploy.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,12 @@ def _upload_deployment(deployment_id: str, archive_path: Path) -> None:
182182

183183
# Upload the archive
184184
logger.debug("Starting file upload to S3")
185-
upload_response = client.post(
186-
upload_data.url,
187-
data=upload_data.fields,
188-
files={"file": archive_path.open("rb")},
189-
)
185+
with open(archive_path, "rb") as archive_file:
186+
upload_response = client.post(
187+
upload_data.url,
188+
data=upload_data.fields,
189+
files={"file": archive_file},
190+
)
190191

191192
upload_response.raise_for_status()
192193
logger.debug("File upload completed successfully")

0 commit comments

Comments
 (0)