Skip to content

Conversation

@max-ostapenko
Copy link
Contributor

  • Add icon existence checks and warnings in ComboBox, TechReport, and TableLinked components

Copilot AI review requested due to automatic review settings December 9, 2025 21:48
@max-ostapenko max-ostapenko changed the title resolving 4XX errors Resolving 4XX errors on the CDN Dec 9, 2025
@max-ostapenko max-ostapenko requested review from tunetheweb and removed request for Copilot December 9, 2025 21:50
Copilot AI review requested due to automatic review settings December 9, 2025 22:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 use encodeURIComponent with 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}`);
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

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().

Suggested change
logo.setAttribute('src', `https://cdn.httparchive.org/v1/static/icons/${icon}`);
logo.setAttribute('src', `https://cdn.httparchive.org/v1/static/icons/${encodeURI(icon)}`);

Copilot uses AI. Check for mistakes.
@max-ostapenko max-ostapenko merged commit 2847ded into main Dec 9, 2025
16 checks passed
@max-ostapenko max-ostapenko deleted the coloured-cow branch December 9, 2025 22:46
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