magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Magento 2.3.4 - Category getImageUrl() returns incorrect value

Open jkenneydaniel opened this issue 4 years ago • 47 comments

Preconditions (*)

  1. Magento 2.3.5-p1 (reproduced only on composer versions)

Steps to reproduce (*)

  1. Go to Admin->Catalog->Categories;
  2. Create a new category with an image;
  3. Go to Storefront and open created before the category

Expected result (*)

  1. Category image src uses the full URL

Actual result (*)

  1. Category image src is actually just a relative path

Additional Info

When uploading an image to categories, it would be expected that when loaded on the frontend the category image URL is loaded so that when the media URL is set (i.e. for CDN usage) - the full URL is used to load the image. This is not the case however because of a change introduced in commit 3c3acd75674039f38ee65d81e8daaa9cbb81fadb where it attempts to determine the path of the image value either being relative or absolute. Considering the backend model for the image attribute is using what would be considered an absolute path, it is simply returning the value without prepending the media URL to the file path.

Example from Magento 2.3.4 with Sample Data

jkenneydaniel avatar May 04 '20 20:05 jkenneydaniel