iffy-pi / apple-shortcuts

A repository for handling the updates and versioning of my apple shortcuts
https://iffy-pi.github.io/apple-shortcuts/
2 stars 0 forks source link

Nutrition Framework - Strings dictionary is empty in installer when installing or updating shortcuts #61

Closed iffy-pi closed 3 months ago

iffy-pi commented 3 months ago

A user reported an error that when they tried to install the shortcut, they got an empty note rather than the instructions to copy and paste. I was able to reproduce this issue myself and was able to trace it to the code that updates the gui_strings.json file in Nutrition Installer: https://github.com/iffy-pi/apple-shortcuts/blob/15d171b66550c38186ae29916396c1a5b88a4e83/projects/nutrition-framework/shortcuts/Nutrition_Installer.py#L188

Strings = Dictionary(GetContentsOfURL(f'https://iffy-pi.github.io/apple-shortcuts/public/nutrition/languages/{Strings['_string_lang_file']}'))

The issue occurs because the value of Strings['_string_lang_file'] is just "gui_strings_en" rather than gui_strings_en.json. Because of this the URL evaluated to a dead link and no dictionary was pulled. This empty dictionary overwrote the value of Strings resulting in the empty dictionary error going forward.

This did not occur in prior releases because updating the Strings dictionary was manually disabled (and unintentionally so).

I can update the remote gui_strings files to have the correct format for "_string_lang_file", meaning that new installs will work as expected. However updates will fail, since the Strings dictionary will pull from gui_strings.json saved to the device, which would have the incorrect format. This would mean updates will not work for some users (at most 24).

Resolving this issue:

iffy-pi commented 3 months ago

The dummy file does not work since the dictionary action does not know how to interpret raw data (which is what it is found to be because it has no file extension). This means that we did brick updates for the small amount of users, 24 downloads as of now

iffy-pi commented 3 months ago

Fast tracking the release of changes. with v4.22 (#60 )

iffy-pi commented 3 months ago

I've also updated my testing processes to completely replicate the situation for a new install or an upgrade by deleting all the previous files and such. This will allow us to capture such edge case failures in the future

iffy-pi commented 3 months ago

Will be updating testing processes in general, tracked with ticket #62