Skip to content

Crash when icon is an SVG file #31

Description

@JulianGro

Apparently, appimagelint crashes when checking SVG icons:

(…)
appimagelint.icons_check[634069] [INFO] Checking resolution of icon: /tmp/.mount_runtimMlomJg/interface.svg
appimagelint.icons_check[634069] [DEBUG] Opening image: /tmp/.mount_runtimMlomJg/interface.svg
appimagelint.appimagemounter[634069] [DEBUG] unmounting AppImage
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/tmp/.mount_appimaNbEPeA/usr/conda/lib/python3.12/site-packages/appimagelint/__main__.py", line 4, in <module>
    run()
  File "/tmp/.mount_appimaNbEPeA/usr/conda/lib/python3.12/site-packages/appimagelint/cli.py", line 142, in run
    for testres in check.run():
                   ^^^^^^^^^^^
  File "/tmp/.mount_appimaNbEPeA/usr/conda/lib/python3.12/site-packages/appimagelint/checks/icons.py", line 97, in run
    valid = self._check_icon_for_valid_resolution(icon)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_appimaNbEPeA/usr/conda/lib/python3.12/site-packages/appimagelint/checks/icons.py", line 279, in _check_icon_for_valid_resolution
    res = self._get_icon_res(icon_path)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_appimaNbEPeA/usr/conda/lib/python3.12/site-packages/appimagelint/checks/icons.py", line 249, in _get_icon_res
    resolution = self._get_svg_icon_res(icon_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_appimaNbEPeA/usr/conda/lib/python3.12/site-packages/appimagelint/checks/icons.py", line 213, in _get_svg_icon_res
    return float(height), float(width)
           ^^^^^^^^^^^^^
ValueError: could not convert string to float: '14.816667mm'
juliangro@x299-workstation ~/g/o/build (conan) [1]> 

This is running version unknown-git24d3bf6.
Here is the offending SVG file for reference:
Image

I guess, the resolution check should just be skipped on SVG files.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions