From 55d417708f8a34c6213c12f53f2f4b0c847b5501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Sun, 23 Feb 2025 10:36:27 +0100 Subject: [PATCH] naprawa redirectu --- app.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 54cfacd..1c27263 100644 --- a/app.py +++ b/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() 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)