Conversation
max-ostapenko
commented
Dec 9, 2025
- Add icon existence checks and warnings in ComboBox, TechReport, and TableLinked components
…ableLinked components
…d TableLinked components
There was a problem hiding this comment.
Pull request overview
This PR addresses 4XX errors on the CDN by adding defensive checks to prevent requests for missing icon files. The changes ensure that icon elements are only created and appended to the DOM when the icon property exists.
Key Changes:
- Added null/undefined checks for icon properties before creating icon elements across multiple components
- Improved URL encoding approach in
getTechInfo()to useencodeURIComponentwith proper join syntax
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/js/techreport/tableLinked.js |
Added icon existence check before creating background-image span element |
src/js/techreport/index.js |
Added icon checks in getTechInfo() and updateDrilldownComponents(), improved URL encoding for technology parameters |
src/js/techreport/combobox.js |
Added icon existence checks before creating img elements in dropdown options and selected items display |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if(icon) { | ||
| const logo = document.createElement('img'); | ||
| logo.setAttribute('alt', ''); | ||
| logo.setAttribute('src', `https://cdn.httparchive.org/v1/static/icons/${icon}`); |
There was a problem hiding this comment.
Inconsistent URL encoding: The icon at line 35 is used directly without encodeURI(), but the icon at line 206 uses encodeURI(icon). For consistency and to prevent potential URL issues with special characters in icon filenames, both should use encodeURI() or encodeURIComponent().
| logo.setAttribute('src', `https://cdn.httparchive.org/v1/static/icons/${icon}`); | |
| logo.setAttribute('src', `https://cdn.httparchive.org/v1/static/icons/${encodeURI(icon)}`); |