Skip to content

Commit

Permalink
bug(Assets): Fix new assets not always saving due to missing folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Kruptein authored Dec 4, 2024
1 parent b75caee commit 62f5521
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/src/api/socket/asset_manager/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,11 @@ async def handle_regular_file(upload_data: ApiAssetUpload, data: bytes, sid: str
sh = hashlib.sha1(data)
hashname = sh.hexdigest()

full_hash_path = get_asset_hash_subpath(hashname)
full_hash_path = ASSETS_DIR / get_asset_hash_subpath(hashname)

if not (ASSETS_DIR / full_hash_path).exists():
with open(ASSETS_DIR / full_hash_path, "wb") as f:
if not full_hash_path.exists():
full_hash_path.parent.mkdir(parents=True, exist_ok=True)
with open(full_hash_path, "wb") as f:
f.write(data)

user = asset_state.get_user(sid)
Expand Down

0 comments on commit 62f5521

Please sign in to comment.