naprawa redirectu
This commit is contained in:
parent
94385e7bda
commit
55d417708f
8
app.py
8
app.py
@ -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()
|
b = Backup.query.filter_by(id=backup_id, router_id=router.id, backup_type='binary').first()
|
||||||
if not b:
|
if not b:
|
||||||
flash("Nie znaleziono backupu binarnego.")
|
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
|
# Sprawdź sumę kontrolną pliku przed wgraniem
|
||||||
local_checksum = compute_checksum(b.file_path)
|
local_checksum = compute_checksum(b.file_path)
|
||||||
if b.checksum != local_checksum:
|
if b.checksum != local_checksum:
|
||||||
flash("Błąd: suma kontrolna backupu nie zgadza się – plik może być uszkodzony.")
|
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:
|
try:
|
||||||
ssh_upload_backup(router, b.file_path, expected_checksum=b.checksum)
|
ssh_upload_backup(router, b.file_path, expected_checksum=b.checksum)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user