Robust delete: handle filesystem unlink errors in hosted file action
This commit is contained in:
@@ -433,8 +433,12 @@ async def delete_file_action(
|
||||
if method == 'delete':
|
||||
# Hard delete: Record + Disk
|
||||
if file_exists_on_disk:
|
||||
pathlib.Path(file_path).unlink()
|
||||
physical_removed = True
|
||||
try:
|
||||
pathlib.Path(file_path).unlink()
|
||||
physical_removed = True
|
||||
except OSError as e:
|
||||
log.error(f"Error unlinking file {file_path}: {e}")
|
||||
physical_removed = False
|
||||
sql_delete(table_name='hosted_file', record_id=file_id_int)
|
||||
record_removed = True
|
||||
elif method == 'hide':
|
||||
|
||||
Reference in New Issue
Block a user