naprawa redirectu

This commit is contained in:
Mateusz Gruszczyński 2025-02-23 10:36:27 +01:00
parent 94385e7bda
commit 55d417708f

8
app.py
View File

@ -907,13 +907,17 @@ def upload_backup(router_id, backup_id):
b = Backup.query.filter_by(id=backup_id, router_id=router.id, backup_type='binary').first()
if not b:
flash("Nie znaleziono backupu binarnego.")
return redirect(url_for('router_details', router_id=router.id))
#return redirect(url_for('router_details', router_id=router.id))
next_url = request.form.get('next') or request.referrer or url_for('dashboard')
return redirect(next_url)
# Sprawdź sumę kontrolną pliku przed wgraniem
local_checksum = compute_checksum(b.file_path)
if b.checksum != local_checksum:
flash("Błąd: suma kontrolna backupu nie zgadza się plik może być uszkodzony.")
return redirect(url_for('router_details', router_id=router.id))
#return redirect(url_for('router_details', router_id=router.id))
next_url = request.form.get('next') or request.referrer or url_for('dashboard')
return redirect(next_url)
try:
ssh_upload_backup(router, b.file_path, expected_checksum=b.checksum)