pylnk
pylnk copied to clipboard
Parse error `IndexError: list index out of range`
-
Windows 8.1 x64
-
Python x64 3.12.1
- Branch:
json
If try to parse that shortcut file: https://github.com/andry81/contools/blob/master/Scripts/Tools/ToolAdaptors/lnk/mycomputer.lnk
pylnk p mycomputer.lnk --json
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "c:\Python\x64\312\Scripts\pylnk3.exe\__main__.py", line 7, in <module>
File "c:\Python\x64\312\Lib\site-packages\pylnk3\cli.py", line 77, in main
lnk = parse(args.filename)
^^^^^^^^^^^^^^^^^^^^
File "c:\Python\x64\312\Lib\site-packages\pylnk3\helpers.py", line 42, in parse
return Lnk(lnk)
^^^^^^^^
File "c:\Python\x64\312\Lib\site-packages\pylnk3\structures\lnk.py", line 122, in __init__
self._parse_lnk_file(f)
File "c:\Python\x64\312\Lib\site-packages\pylnk3\structures\lnk.py", line 168, in _parse_lnk_file
self.shell_item_id_list = LinkTargetIDList(lnk.read(shell_item_id_list_size))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Python\x64\312\Lib\site-packages\pylnk3\structures\id_list\id_list.py", line 24, in __init__
self._interpret(raw)
File "c:\Python\x64\312\Lib\site-packages\pylnk3\structures\id_list\id_list.py", line 33, in _interpret
if len(raw[1]) == 0x17:
~~~^^^
IndexError: list index out of range
Note: This is a legit valid shortcut file has been created with shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
in the TargetPath
property.