typo3_encore icon indicating copy to clipboard operation
typo3_encore copied to clipboard

SvgViewhelper assumes that the SvgSpriteMap is always available locally as a file.

Open nm-dh opened this issue 2 years ago • 1 comments

We use the webpack-dev-server from Webpack and this provides our SvgSpriteMap as URL. The AssetViewhelper can handle such URL's but the Viewhelper for SVG's can't yet but should be extended.

What we noticed: The AssetViewhelper seems to use a PackageFactory.

$this->packageFactory->getPackage($this->arguments['package'])->getUrl($this->filesystem->getRelativeFilePath($this->arguments['pathToFile']));

The SvgViewhelper always seems to look for a local file.

$image = $this->imageService->getImage($this->arguments['src'], null, false);

image

nm-dh avatar May 05 '22 10:05 nm-dh

Would you like to investigate more and fix this issue? Would be awesome, because i have no real setup to reproduce and fix this issue. Thank you.

sabbelasichon avatar May 06 '22 08:05 sabbelasichon

@nm-dh Do you have any idea how to fix this issue. Would be really cool to have a complete setup here.

sabbelasichon avatar Nov 08 '22 07:11 sabbelasichon

Unfortunately, I have not yet been able to follow up the error.

nm-dh avatar Nov 08 '22 08:11 nm-dh

@nm-dh Could you please check if the master is working for you? I have added a simple fallback mechanism for the SvgViewHelper

sabbelasichon avatar Dec 16 '22 08:12 sabbelasichon

@sabbelasichon

I checked it and it does not work for me.

I posted a fast solution in this comment. https://github.com/sabbelasichon/typo3_encore/issues/174#issuecomment-1416228158

But even after fixing with my proposal there is still problem. In browser console there is an error:

Unsafe attempt to load URL https://t3base11.ddev.site:8080/assets/frontend/build/sprite.410880c0095f36da6e63c4ea5ec898ae.svg from frame with URL https://t3base11.ddev.site/. Domains, protocols and ports must match.

A solution is to make svg inline.

kszymukowicz avatar Feb 03 '23 19:02 kszymukowicz