thilojaeggi / WinGetty

An open source REST Backend for creating a private WinGet Repo without having to rely on cloud dependencies.
https://wingetty.dev
GNU Affero General Public License v3.0
191 stars 18 forks source link

Version comparison between int and str #56

Open gabriel-gfs opened 6 months ago

gabriel-gfs commented 6 months ago

After adding a package with a version v2.14.22 and a version 2.14.20 i get this error in the logs and no packages are displayed in the packages section.

[2024-05-24 09:43:54 +0200] [8] [ERROR] [WinGetty] Exception on /api/packages [GET] Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(view_args) File "/usr/local/lib/python3.9/site-packages/flask_login/utils.py", line 290, in decorated_view return current_app.ensure_sync(func)(*args, *kwargs) File "/app/app/decorators.py", line 24, in wrapper return func(args, kwargs) File "/app/app/api_routes.py", line 71, in packages 'packages': [package.to_dict() for package in packages], File "/app/app/api_routes.py", line 71, in 'packages': [package.to_dict() for package in packages], File "/app/app/models.py", line 29, in to_dict "versions": sorted( File "/usr/local/lib/python3.9/distutils/version.py", line 52, in lt c = self._cmp(other) File "/usr/local/lib/python3.9/distutils/version.py", line 341, in _cmp if self.version < other.version: TypeError: '<' not supported between instances of 'str' and 'int'