DanSheps/netbox-config-backup

Unicode error with description characters within config.

Opened this issue · 1 comments

Plugin version

current

NetBox version

3.4.5

Python version

3.9

Steps to Reproduce

Config backup seems to run and file is in git. "Last Backup" field in grid goes blank.

Clicking that job shows uid and going to the git dir, cat uid.running does show the valid config.

Clicking the job config specifically though gives a unicode error.

The string that could not be encoded/decoded was: - Fl���� N

Legit that the characters are there. They were imported from Peeringdb via peeringmanager as descriptions for bgp.

            description "Peering: AS32098 - Fl� Networks";
            description "Peering: AS32098 - Fl� Networks";

Expected Behavior

Mask or handle characters without error.

Observed Behavior

'ascii' codec can't decode byte 0xc3 in position 52799: ordinal not in range(128)
Request Method:	GET
Request URL:	https://netbox.netfortris.net/plugins/configbackup/devices/22/config/26/
Django Version:	4.1.7
Exception Type:	UnicodeDecodeError
Exception Value:	
'ascii' codec can't decode byte 0xc3 in position 52799: ordinal not in range(128)
Exception Location:	/opt/netbox/venv/lib64/python3.11/site-packages/netbox_config_backup/git.py, line 96, in read
Raised during:	netbox_config_backup.views.ConfigView
Python Executable:	/opt/netbox/venv/bin/python3
Python Version:	3.11.2
Python Path:	
['/opt/netbox/netbox',
 '/opt/netbox/venv/lib64/python3.11/site-packages/git/ext/gitdb',
 '/opt/netbox',
 '/opt/netbox/venv/bin',
 '/usr/lib64/python311.zip',
 '/usr/lib64/python3.11',
 '/usr/lib64/python3.11/lib-dynload',
 '/opt/netbox/venv/lib64/python3.11/site-packages',
 '/opt/netbox/venv/lib/python3.11/site-packages']
Server time:	Mon, 27 Mar 2023 18:13:38 +0000

This is an issue as we simply choose to decode as ASCII. I could likely encode/decode as utf but there might be issues with that.