Avoid upload_asset()
git fails to delete files we have uploaded, and I'm wondering if upload_asset() is somehow keeping a handle open. While I can't find anything suspicious in pygithub let's make the file handling explicit and open/close ourselves.
This commit is contained in:
parent
76a815c145
commit
b51cfd02af
@ -224,7 +224,9 @@ def upload_asset(release: GitRelease, path: PathLike, replace: bool = False,
|
||||
def upload() -> None:
|
||||
with make_writable(release):
|
||||
if content is None:
|
||||
release.upload_asset(str(path), label=asset_label, name=asset_name)
|
||||
with open(path, "rb") as fileobj:
|
||||
release.upload_asset_from_memory( # type: ignore
|
||||
fileobj, os.path.getsize(path), label=asset_label, name=asset_name)
|
||||
else:
|
||||
with io.BytesIO(content) as fileobj:
|
||||
release.upload_asset_from_memory( # type: ignore
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user