Skip to content

fix: normalize Magento category media paths - #65

Merged
Dennis Garding (DennisGarding) merged 6 commits into
trunkfrom
18903/fix-category-media-url
Aug 12, 2026
Merged

Dennis Garding (DennisGarding) merged 6 commits into
trunkfrom
18903/fix-category-media-url

Conversation

@DennisGarding

@DennisGarding Dennis Garding (DennisGarding) commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes: shopware/shopware#18903

1. Why is this change necessary?

Magento category image values can already contain the /media/catalog/category/ prefix. The Migration Assistant currently prepends this prefix unconditionally, resulting in invalid paths such as:

/media/catalog/category//media/catalog/category/example.jpg

As a result, category images cannot be downloaded during migration.

2. What does this change do, exactly?

Category media paths are normalized before creating the migration media-file URI.

The prefix is added only when it is missing, and leading slashes are normalized so that all supported input formats produce a canonical URI:

/media/catalog/category/example.jpg

A regression test covers bare filenames as well as paths with and without a leading slash.

Comment thread src/Profile/Magento/Converter/CategoryConverter.php
Comment thread src/Profile/Magento/Converter/CategoryConverter.php
Comment thread tests/Profile/Magento/Media/LocalMediaProcessorTest.php Outdated
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.

[Migration][Magento] Category image path is built twice (/media/catalog/category//media/catalog/category/…) — images 404 silently

3 participants