Fix permanent delete
This commit is contained in:
@@ -652,14 +652,16 @@ def delete_permanent(room_id):
|
||||
if not rf:
|
||||
continue
|
||||
|
||||
# Delete the file from storage if it's a file
|
||||
if rf.type == 'file':
|
||||
try:
|
||||
file_path = os.path.join(get_room_dir(room_id), rf.path, rf.name)
|
||||
if os.path.exists(file_path):
|
||||
# Delete the file/folder from storage
|
||||
try:
|
||||
file_path = os.path.join(get_room_dir(room_id), rf.path, rf.name)
|
||||
if os.path.exists(file_path):
|
||||
if rf.type == 'file':
|
||||
os.remove(file_path)
|
||||
except Exception as e:
|
||||
print(f"Error deleting file from storage: {e}")
|
||||
elif rf.type == 'folder':
|
||||
shutil.rmtree(file_path)
|
||||
except Exception as e:
|
||||
print(f"Error deleting {rf.type} from storage: {e}")
|
||||
|
||||
# Delete the database record
|
||||
db.session.delete(rf)
|
||||
|
||||
Reference in New Issue
Block a user