fix: attach the original D-Link config.bin as configuration backup

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-11-05 12:50:19 +01:00
1 parent 781ed7d17b
commit 63ed535a37
4 files changed
+43 -8

No files matched your search

+5 -1
View File
@@ -14,6 +14,7 @@ Supported formats:
A plain text ``SNCSR.conf`` is accepted as well.
"""
import base64
import io
import ipaddress
import re
@@ -44,7 +45,10 @@ def parse_backup(data, filename=""):
data = data.encode("utf-8")
dump = _dlink_dump(data)
if dump is not None:
return _dlink_snapshot(dump, data)
switch, snapshot = _dlink_snapshot(dump, data)
# The original file is attached 1:1 so it can be restored on the switch.
snapshot["config_file"] = {"name": filename or "config.bin", "data": base64.b64encode(data).decode("ascii")}
return switch, snapshot
text = _linksys_text(data)
if text is not None:
return _linksys_snapshot(text)