smartstore / Smartstore

A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 7
http://www.smartstore.com/
GNU Affero General Public License v3.0
1.2k stars 447 forks source link

model.MetaProperties.ImageUrl Image address problem #1047

Closed AtlantisDe closed 6 months ago

AtlantisDe commented 7 months ago

Model

ProductDetailsModel 

Attribute

model.MetaProperties.ImageUrl

Test In

src/Smartstore.Web/Controllers/ProductController.cs

//ProductDetails
 public async Task<IActionResult> ProductDetails(int productId, ProductVariantQuery query)
 {

            model.MetaProperties = await model.MapMetaPropertiesAsync();

            model.MetaProperties.ImageUrl = model.MetaProperties.ImageUrl.Replace("http://localhost", "");

problem image

  1. Get the image address, incorrect

http://localhost/media/8/catalog/TikTok.png

//The reverse proxy I actually use uses a public domain name

//The relative address should be obtained, for example

/media/8/catalog/TikTok.png

Test configuration

image

Michael-Herzog commented 6 months ago

Hi,

please explain why this is a problem. This was implemented like this by design. The responsible code can be found here

imageUrl = WebHelper.GetAbsoluteUrl(imageUrl, request, true);

When an URL is posted to a social media platform it needs the complete URL in order to request the image.

Regards, Michael