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)