mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-05 21:25:19 +02:00
Potential fix for code scanning alert no. 29: Information exposure through an exception
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
parent
015bd64c14
commit
c58dc726f7
1 changed files with 3 additions and 1 deletions
|
@ -320,7 +320,9 @@ class BackupViewSet(viewsets.ViewSet):
|
||||||
return Response({'error': 'Invalid JSON in backup file'},
|
return Response({'error': 'Invalid JSON in backup file'},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return Response({'error': f'Import failed: {str(e)}'},
|
import logging
|
||||||
|
logging.error("Import failed", exc_info=True)
|
||||||
|
return Response({'error': 'An internal error occurred during import'},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
finally:
|
finally:
|
||||||
os.unlink(tmp_file_path)
|
os.unlink(tmp_file_path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue