fix skins and capes saves
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from app.db.database import users_collection
|
||||
from app.core.config import FILES_URL
|
||||
from app.core.config import CAPES_DIR, FILES_URL
|
||||
from fastapi import HTTPException, UploadFile
|
||||
from datetime import datetime
|
||||
|
||||
@ -30,7 +30,7 @@ class CapeService:
|
||||
import os
|
||||
old_url = user["cloak_url"]
|
||||
old_filename = os.path.basename(urlparse(old_url).path)
|
||||
old_path = os.path.join("/app/static/capes", old_filename)
|
||||
old_path = CAPES_DIR / old_filename
|
||||
if os.path.exists(old_path):
|
||||
try:
|
||||
os.remove(old_path)
|
||||
@ -39,7 +39,7 @@ class CapeService:
|
||||
|
||||
# Создаем папку для плащей, если ее нет
|
||||
from pathlib import Path
|
||||
cape_dir = Path("/app/static/capes")
|
||||
cape_dir = CAPES_DIR
|
||||
cape_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
cape_filename = f"{username}_{int(datetime.now().timestamp())}.{ext}"
|
||||
|
||||
Reference in New Issue
Block a user