Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const productTransformer =
(item: Hash): Product => {
const id = get(item, ['id'], '');
let imageUrl = get(item, ['images', 0, 'url'], '');
if (imageUrl.length > 0) {
if (imageUrl.length > 0 && !imageUrl.startsWith('http://') && !imageUrl.startsWith('https://')) {
imageUrl = apiEndpoint + imageUrl;
}
Comment on lines +13 to 15
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

The new behavior (skipping apiEndpoint prefix when imageUrl is absolute) isn’t covered by unit tests. Please add cases asserting that relative URLs (e.g. "/media/123") are prefixed and absolute URLs (e.g. "https://static.test.com/media/123") are left unchanged.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Copilot apply changes based on this feedback

const sku = get(item, ['code'], '');
Expand Down Expand Up @@ -42,7 +42,7 @@ export const productDetailsTransformer =
(item: Hash): Product => {
const id = get(item, ['id'], '');
let imageUrl = get(item, ['images', 0, 'url'], '');
if (imageUrl.length > 0) {
if (imageUrl.length > 0 && !imageUrl.startsWith('http://') && !imageUrl.startsWith('https://')) {
imageUrl = apiEndpoint + imageUrl;
}
Comment on lines +45 to 47
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

This updated absolute-vs-relative URL guard in productDetailsTransformer should be exercised in tests as well (relative image URL gets prefixed; absolute image URL passes through) to prevent regressions.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Copilot apply changes based on this feedback

return {
Expand Down