Distribution
Mint 22.3
Package version
6.6.7
Graphics hardware in use
No response
Frequency
Always
Bug description
I'm very new to Linux. The following report was written by Claude.
Started getting the following message with Applets, Desklets, Actions and Themes when trying to refresh the cache (Download).
Description:
The Applets/Desklets/Extensions/Themes download manager intermittently fails with a generic "An error occurred while trying to access the server" dialog. Running cinnamon-settings applets from a terminal and adding a traceback.print_exc() in the relevant except block in Spices.py reveals the actual cause:
Traceback (most recent call last):
File "/usr/share/cinnamon/cinnamon-settings/bin/Spices.py", line 395, in _download
self._url_retrieve(url, outfd, self._update_progress, binary)
File "/usr/share/cinnamon/cinnamon-settings/bin/Spices.py", line 435, in _url_retrieve
raise e
File "/usr/share/cinnamon/cinnamon-settings/bin/Spices.py", line 424, in _url_retrieve
totalSize = int(response.headers.get('content-length'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Root cause:
_url_retrieve() in Spices.py assumes every response from cinnamon-spices.linuxmint.com includes a content-length header:
response = requests.get(url, proxies=proxy_info, stream=True, timeout=15)
assert response.ok
totalSize = int(response.headers.get('content-length'))
This isn't guaranteed by HTTP (e.g. chunked transfer-encoding responses omit it), and in my case it happens intermittently, seemingly under the parallel/multi-threaded download load the manager generates. curl -sD - against the same JSON endpoint immediately afterward shows a normal response with content-length present, and the site sits behind Sucuri/Cloudproxy, which suggests the bot-protection/WAF layer is occasionally returning a different (challenge or rate-limited) response to the burst of concurrent non-browser requests, without a content-length header — and the client crashes instead of handling it gracefully.
Steps to reproduce
Hard to reproduce reliably on demand since it depends on server/WAF behavior under load, but it recurs regularly when opening the Applets/Desklets/Extensions/Themes download tabs.
Expected behavior
It should refresh without crashing.
Additional information
Suggested fix:
Guard against a missing header instead of crashing:
pythoncontent_length = response.headers.get('content-length')
totalSize = int(content_length) if content_length is not None else -1
(and have the progress-reporting callback tolerate totalSize == -1 as "unknown size" rather than trying to compute a percentage from it.)
I've applied this locally and confirmed it resolves the crash for me.
Distribution
Mint 22.3
Package version
6.6.7
Graphics hardware in use
No response
Frequency
Always
Bug description
I'm very new to Linux. The following report was written by Claude.
Started getting the following message with Applets, Desklets, Actions and Themes when trying to refresh the cache (Download).
Description:
The Applets/Desklets/Extensions/Themes download manager intermittently fails with a generic "An error occurred while trying to access the server" dialog. Running cinnamon-settings applets from a terminal and adding a traceback.print_exc() in the relevant except block in Spices.py reveals the actual cause:
Traceback (most recent call last):
File "/usr/share/cinnamon/cinnamon-settings/bin/Spices.py", line 395, in _download
self._url_retrieve(url, outfd, self._update_progress, binary)
File "/usr/share/cinnamon/cinnamon-settings/bin/Spices.py", line 435, in _url_retrieve
raise e
File "/usr/share/cinnamon/cinnamon-settings/bin/Spices.py", line 424, in _url_retrieve
totalSize = int(response.headers.get('content-length'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Root cause:
_url_retrieve() in Spices.py assumes every response from cinnamon-spices.linuxmint.com includes a content-length header:
response = requests.get(url, proxies=proxy_info, stream=True, timeout=15)
assert response.ok
totalSize = int(response.headers.get('content-length'))
This isn't guaranteed by HTTP (e.g. chunked transfer-encoding responses omit it), and in my case it happens intermittently, seemingly under the parallel/multi-threaded download load the manager generates. curl -sD - against the same JSON endpoint immediately afterward shows a normal response with content-length present, and the site sits behind Sucuri/Cloudproxy, which suggests the bot-protection/WAF layer is occasionally returning a different (challenge or rate-limited) response to the burst of concurrent non-browser requests, without a content-length header — and the client crashes instead of handling it gracefully.
Steps to reproduce
Hard to reproduce reliably on demand since it depends on server/WAF behavior under load, but it recurs regularly when opening the Applets/Desklets/Extensions/Themes download tabs.
Expected behavior
It should refresh without crashing.
Additional information
Suggested fix:
Guard against a missing header instead of crashing:
pythoncontent_length = response.headers.get('content-length')
totalSize = int(content_length) if content_length is not None else -1
(and have the progress-reporting callback tolerate totalSize == -1 as "unknown size" rather than trying to compute a percentage from it.)
I've applied this locally and confirmed it resolves the crash for me.