gd.py icon indicating copy to clipboard operation
gd.py copied to clipboard

Possible NULL bytes need to be handled in save parsing.

Open endert1099 opened this issue 2 years ago • 1 comments

I put in the code to load local levels(from the docs)

database = gd.api.save.load()

When I try, I get the following error stack:

Traceback (most recent call last):
  File "c:\Users\ender\Documents\codingprojects\mov2gd\edit.py", line 40, in <module>
    db = gd.api.save.load()
         ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\site-packages\gd\api\save_manager.py", line 119, in load
    return self.load_parts(main_data, levels_data, apply_xor=True, follow_system=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\site-packages\gd\api\save_manager.py", line 145, in load_parts
    return self.database_type.load_parts(main, levels)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\site-packages\gd\api\database\database.py", line 294, in load_parts
    main_payload = parser.load(main)
                   ^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\site-packages\gd\plist.py", line 90, in load
    plist = from_string(string)
            ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\xml\etree\ElementTree.py", line 1338, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: reference to invalid character number: line 1, column 10250471

It could be something with my save but I have no idea how to fix it

endert1099 avatar Dec 09 '23 14:12 endert1099

Perhaps this issue can be resolved via handling possible NULL bytes in the save.

nekitdev avatar Dec 30 '23 16:12 nekitdev