📝 'feat': Renamed and moved various documentation files to '/docs/' directory
This commit is contained in:
22
backend/app/utils/fix_csrf.py
Normal file
22
backend/app/utils/fix_csrf.py
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Entferne problematischen CSRF-Error-Handler aus app.py"""
|
||||
|
||||
import re
|
||||
|
||||
# Lese die Backup-Datei
|
||||
with open('app_backup.py', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Entferne den CSRF-Error-Handler-Block
|
||||
# Suche nach @csrf.error_handler bis zum ersten leeren Zeilen-Block
|
||||
pattern = r'@csrf\.error_handler.*?(?=\n\n|\n# [A-Z])'
|
||||
content = re.sub(pattern, '', content, flags=re.DOTALL)
|
||||
|
||||
# Entferne auch mögliche doppelte Leerzeilen
|
||||
content = re.sub(r'\n\n\n+', '\n\n', content)
|
||||
|
||||
# Schreibe die bereinigte Version
|
||||
with open('app.py', 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
print("CSRF-Error-Handler erfolgreich entfernt!")
|
Reference in New Issue
Block a user