weather/envcan: Fix handling of non-continuous hourly folder list
Reason for the change
The previous code assumed the provider would always have a continuous list of hourly folders that contain the forecast files. This is the case most of the times, but I found an instance where this list had an odd '23' folder leftover from the day before.
This was probably a small bug on the provider's side, but it would make the forecast fail for users in that region the whole day.
Let's handle this in a more robust way, by storing the whole sorted list of folders and following it along.
Test plan
It depends on a specific "bug" on the provider's site, that only happens some days on some regions (but it has already happened twice in the last 4 days), when the page at https://dd.weather.gc.ca/today/citypage_weather/ON/ includes a folder for 23
hours
- In the Weather Widget set the location to "Toronto, ON (Evironment Canada)"
BEFORE
There is no data in the 23
folder, so we naïvely try with 22
which doesn't exists, failing to fetch the correct file
kde.dataengine.ion.envcan: Fetching weather URL: "https://dd.weather.gc.ca/today/citypage_weather/ON/"
kde.dataengine.ion.envcan: Fetching weather URL: "https://dd.weather.gc.ca/today/citypage_weather/ON/23/"
kde.dataengine.ion.envcan: Fetching weather URL: "https://dd.weather.gc.ca/today/citypage_weather/ON/22/"
AFTER
We have stored the list of available folders, so after 23
we correctly try on 12
kde.dataengine.ion.envcan: Fetching weather URL: "https://dd.weather.gc.ca/today/citypage_weather/ON/"
kde.dataengine.ion.envcan: Fetching weather URL: "https://dd.weather.gc.ca/today/citypage_weather/ON/23/"
kde.dataengine.ion.envcan: Fetching weather URL: "https://dd.weather.gc.ca/today/citypage_weather/ON/12/"
kde.dataengine.ion.envcan: Fetching weather URL: "https://dd.weather.gc.ca/today/citypage_weather/ON/12/20250623T120424.641Z_MSC_CitypageWeather_s0000458_en.xml"
Bugs fixed
Prevent "Weather not available" error in some specific cases and locations
BEFORE | AFTER |
---|---|
![]() |
![]() |
Proposing to cherry-pick to 6.4.