Conversation
Co-authored-by: drqsatoshi <240532885+drqsatoshi@users.noreply.github.com>
|
Warning MetaMask internal reviewing guidelines:
|
| // Download or copy | ||
| if (opts.logo.startsWith("http://") || opts.logo.startsWith("https://")) { | ||
| console.log(`Downloading icon from: ${opts.logo}`); | ||
| await downloadFile(opts.logo, iconAbsPath); |
There was a problem hiding this comment.
Old icon deleted before download confirmed, causing data loss
Medium Severity
When the icon format changes, commandUpdate deletes the old icon via fs.unlinkSync at line 246 before the replacement download at line 257 completes. If the HTTP download fails (network error, timeout, non-200 status), the old icon is already gone, the new icon doesn't exist or is partial, and the metadata file still references the old (now-deleted) path. The asset is left in a broken state with no icon file. The deletion needs to happen after the new icon is confirmed on disk.


Note
Medium Risk
Adds a new CLI that can write/delete local metadata and icon files and introduces a large new
package-lock.json; changes are mostly tooling/docs but could impact contributor workflows and release packaging if misused or misconfigured.Overview
Introduces a new
cli-update-asset.jstool toupdate,verify, andlistCAIP-19 assets by reading/writingmetadata/<chain>/<asset>.jsonand managing icon files (including downloading/copying and removing old icons when the format changes), with validation againstpermitted-fields.jsonand optional EVM checksum checking.Wires the CLI into npm scripts (
asset:*,test:cli), expands the test suite withtest/cli-update-asset.js, bumps package version to2.5.1, and adds apackage-lock.json. Documentation is updated to reflect the CAIP-19 metadata/icon directory layout and to add AI assistant guidance (CLAUDE.md,.github/copilot-instructions.md), plus a CODEOWNERS update.Written by Cursor Bugbot for commit cb3eb8f. This will update automatically on new commits. Configure here.