Conversation
Closes #19984 Summary of the issue: Once an add-on is installed, VirusTotal scan results would be cached in a different format than what was served by the server. This would cause issues in unpacking the scanned data. This would cause scan results to fail to be loaded for installed add-ons. Description of user facing changes: Viewing scan results for installed add-ons should be fixed Description of developer facing changes: None Description of development approach: Added a toDict method to the VirusTotalScanResults class in scanResults.py, enabling conversion of scan result objects to a dictionary format matching the original scan results structure. Updated the asdict method in AddonStoreModel to use toDict for VirusTotalScanResults fields, ensuring correct serialization.
There was a problem hiding this comment.
Pull request overview
This PR updates zh_TW locale symbol mappings and improves add-on store model serialization by enabling round-tripping of VirusTotal scan results to the original API/cache JSON shape.
Changes:
- Updated
zh_TWsymbols.dicheader date and added several missing symbol pronunciation mappings. - Added
VirusTotalScanResults.toDict()to serialize scan stats back into the expectedscanResultsstructure. - Updated add-on model serialization/type hints to emit
vtScanUrl+scanResultsin the expected cached/JSON format.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
source/locale/zh_TW/symbols.dic |
Updates edit date and adds new symbol pronunciation entries. |
source/addonStore/models/scanResults.py |
Adds toDict() for serializing scan results back to the expected dict structure. |
source/addonStore/models/addon.py |
Updates typing and asdict() to correctly serialize VirusTotalScanResults and vtScanUrl for caching/interop. |
| """Store scan data in the same format as the original add-on scan results. | ||
|
|
||
| :return: A dictionary representing the scan results. |
There was a problem hiding this comment.
The docstring for toDict says it stores data "in the same format as the original add-on scan results", but this method only serializes the scanResults structure and does not include the vtScanUrl/scanUrl portion (which is stored separately on the add-on dict). Please clarify the wording to reflect that it returns the format for addon["scanResults"] (or explicitly document how vtScanUrl is handled elsewhere).
| """Store scan data in the same format as the original add-on scan results. | |
| :return: A dictionary representing the scan results. | |
| """Store scan data in the format used for ``addon["scanResults"]``. | |
| This serializes only the VirusTotal scan results payload. The scan URL | |
| (``vtScanUrl``, represented by :attr:`scanUrl`) is stored separately on the | |
| add-on dictionary and is not included in this return value. | |
| :return: A dictionary representing ``addon["scanResults"]``. |
No description provided.