Description
Duplicate WebView assets can be omitted from the returned webViewAssetMap.
When multiple WebView files have identical contents, #mapAssets() correctly deduplicates them so that only one file is uploaded. However, the duplicate file paths are not subsequently mapped to the uploaded asset URL.
As a result, only the first unique path may be present in webViewAssetMap, while other files with the same hash and size are missing.
Current behavior
Given two WebView assets with identical contents:
client/header-logo.svg
client/footer-logo.svg
the CLI may:
- classify one file as a new asset;
- classify the other as a duplicate;
- upload only the first file;
- add only the first file path to
webViewAssetMap.
The duplicate path is not associated with the uploaded URL.
The regular-media upload path already performs a final hash-and-size lookup that maps duplicate paths to the same uploaded asset ID. The WebView upload path does not appear to have equivalent behavior.
Expected behavior
Duplicate WebView assets should continue to be uploaded only once, but every original file path should be included in webViewAssetMap.
For example:
{
"header-logo.svg": "https://example.com/uploaded-asset",
"footer-logo.svg": "https://example.com/uploaded-asset"
}
Both paths should resolve to the same uploaded URL.
Proposed implementation
Track uploaded WebView asset URLs by a stable signature such as:
`${asset.hash}:${asset.size}`
After each unique asset is uploaded:
- associate its signature with the final uploaded URL;
- add the unique asset path to
assetMap;
- add every duplicate path with the same signature to
assetMap.
The duplicate lookup in #mapAssets() currently scans the growing newAssets array with .find(). Replacing that lookup with a signature Set or Map would also reduce duplicate classification from O(n²) to O(n).
Acceptance criteria
- Duplicate WebView files are uploaded only once.
- Every duplicate file path is included in
webViewAssetMap.
- Duplicate paths resolve to the same uploaded URL.
- Files with the same size but different hashes are not deduplicated.
- Existing behavior for unique and already-existing WebView assets remains unchanged.
- Regression tests cover at least two WebView files with different paths and identical contents.
Description
Duplicate WebView assets can be omitted from the returned
webViewAssetMap.When multiple WebView files have identical contents,
#mapAssets()correctly deduplicates them so that only one file is uploaded. However, the duplicate file paths are not subsequently mapped to the uploaded asset URL.As a result, only the first unique path may be present in
webViewAssetMap, while other files with the same hash and size are missing.Current behavior
Given two WebView assets with identical contents:
the CLI may:
webViewAssetMap.The duplicate path is not associated with the uploaded URL.
The regular-media upload path already performs a final hash-and-size lookup that maps duplicate paths to the same uploaded asset ID. The WebView upload path does not appear to have equivalent behavior.
Expected behavior
Duplicate WebView assets should continue to be uploaded only once, but every original file path should be included in
webViewAssetMap.For example:
Both paths should resolve to the same uploaded URL.
Proposed implementation
Track uploaded WebView asset URLs by a stable signature such as:
`${asset.hash}:${asset.size}`After each unique asset is uploaded:
assetMap;assetMap.The duplicate lookup in
#mapAssets()currently scans the growingnewAssetsarray with.find(). Replacing that lookup with a signatureSetorMapwould also reduce duplicate classification from O(n²) to O(n).Acceptance criteria
webViewAssetMap.