Skip to content

Always use utf-8 for addon store caches#15241

Merged
seanbudd merged 2 commits into
nvaccess:betafrom
mzanm:addon-store-unicode
Aug 2, 2023
Merged

Always use utf-8 for addon store caches#15241
seanbudd merged 2 commits into
nvaccess:betafrom
mzanm:addon-store-unicode

Conversation

@mzanm

@mzanm mzanm commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

Link to issue number:

Closes #15231

Summary of the issue:

If NVDA language is set to Serbian, the cache could get corrupted while reading or writing do to the encoding not specified while opening the file.

Description of user facing changes

NVDA add-on store works with Serbian. Also, If the cached installed addon data is invalid, the exception will be logged similar to the add-on store cache, instead of preventing the add-on store from launching.

Description of development approach

  • open all files in _addonStore\dataManager.py in utf-8.
  • If the file is unable to be opened, or json.load fails, the exception will be logged.

Testing strategy:

Installed multiple add-ons, with Serbian translation and without, while NVDA's language is set to Serbian.

Known issues with pull request:

None.

Change log entries:

New features
Changes
Bug fixes

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • Security precautions taken.

@mzanm mzanm requested a review from a team as a code owner August 1, 2023 09:17
@mzanm mzanm requested review from seanbudd and removed request for a team August 1, 2023 09:17
Comment thread source/_addonStore/dataManager.py Outdated
Comment thread source/_addonStore/dataManager.py Outdated
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
@mzanm

mzanm commented Aug 2, 2023

Copy link
Copy Markdown
Contributor Author

After not removing the file, it appears that the exception is getting logged multiple times. After launching the add-on store, when switching tabs sometimes and, when focused on the add-on with the invalid cache.

@seanbudd

seanbudd commented Aug 2, 2023

Copy link
Copy Markdown
Member

@mzanm - I think that is preferred. Users should be able to fix this by reinstalling from the add-on store. Otherwise, it is helpful to keep the file around for debugging. We can perhaps supress the log level, however, I figure it would be helpful noise to have to get feedback from alpha/beta users as well as indicate to current beta users that they may need to reinstall their add-ons.

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mzanm

@seanbudd seanbudd merged commit 5b972fe into nvaccess:beta Aug 2, 2023
@nvaccessAuto nvaccessAuto added this to the 2023.3 milestone Aug 2, 2023
@seanbudd seanbudd modified the milestones: 2023.3, 2023.2 Aug 2, 2023
@mzanm mzanm deleted the addon-store-unicode branch August 2, 2023 07:08
seanbudd added a commit that referenced this pull request Aug 30, 2023
…lid (#15346)

Raised due to #15345
Fix up of #15241

Summary of the issue:
Add-ons installed from the add-on store in NVDA versions before 2023.2beta2 may have invalid encoding in their add-on store cache file.
This causes an error to be logged, and the add-on to be treated as an externally installed add-on.
The file name of the invalid add-on cache file is not logged with the error.
This information is required for debugging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants