Skip to content

Commit

Permalink
Fix code scanning alert no. 9: Information exposure through an exception
Browse files Browse the repository at this point in the history
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 13bda40 commit 90e6547
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/apps/research/admin/article_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def generate_summary_view(self, request):
gpt_summary = asyncio.run(self._generate_summary(content))
return JsonResponse({'summary': gpt_summary})
except Exception as e:
return JsonResponse({'error': str(e)}, status=500)
import logging
logging.error("An error occurred while generating the summary", exc_info=True)
return JsonResponse({'error': 'An internal error has occurred!'}, status=500)
return JsonResponse({'error': 'Invalid request method'}, status=400)

def current_slug_history(self, obj):
Expand Down

0 comments on commit 90e6547

Please sign in to comment.