Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error Displaying Uploaded Images in <sbb-image> Component #2595

Closed
3 tasks done
tobiasBlaser opened this issue Apr 17, 2024 · 1 comment
Closed
3 tasks done
Labels
type: bug 🐛 Something isn't working

Comments

@tobiasBlaser
Copy link

Preflight Checklist

Bug type

Functionality

It affects the following packages

Components

Which version of Lyne Components are you using

0.49.0

Operating system

Windows 10 / MacOS

Browser / Browser version

Chrome 23.0.6312.123

Input mode

None

Additional settings

No response

What happened?

We are developing a feature for file upload with preview using the and components.
We have encountered an issue where the component fails to display images that are uploaded via the .
However, the images can be displayed without issues using a native HTML tag.

Steps to reproduce the issue

We are developing a feature for file upload with preview using the and components.
We have encountered an issue where the component fails to display images that are uploaded via the .
However, the images can be displayed without issues using a native HTML tag.

Steps to Reproduce:
1.) Use the component to upload an image file:
<sbb-file-selector
...
(fileChanged)="uploadFile($event)"

...

2.) The uploadFile function processes the uploaded file and stores the Blob URL in the media variable:
public media = '';

protected uploadFile(e: unknown): void {
const files = (e as CustomEvent<File[]>).detail;
if (files?.[0]) {
this.media = URL.createObjectURL(files[0]);
...
}
}

3.) Attempt to display the image using the component by binding the Blob URL to the imageSrc property:
<sbb-image [imageSrc]="media" [skipLqip]="true" />

Expected Behavior:
The component should display the uploaded image similarly to how the native HTML tag does.

Actual Behavior:
The component triggers an error in the browser console:
GET blob:http://localhost:4242/7857894b-3660-4ef0-b775-cf641775eeb1?auto=format%2Ccompress%2Ccs%3Dtinysrgb&w=976&h=549&q=45
net::ERR_FILE_NOT_FOUND

It appears that the component appends additional parameters such as format, compress, cs, w, h, and q to the URL,
which are not part of the original Blob URL which looks like this:
blob:http://localhost:4242/7857894b-3660-4ef0-b775-cf641775eeb1

Additional Information:
Using the property [skipLqip]="true" in the component prevents an additional error from occurring but does not
solve the image display issue. Both errors only occur with images uploaded internally via the file upload feature,
while external URLs work without errors.

Relevant log output

GET blob:http://localhost:4242/8730657a-16a7-4af1-99fc-1afe05adcf86?blur=100&w=100&h=56 net::ERR_FILE_NOT_FOUND

GET blob:http://localhost:4242/4bfe3820-0a17-4b64-b7a8-f882de7aca3a?auto=format%2Ccompress%2Ccs%3Dtinysrgb&w=2400&h=1350&q=20 net::ERR_FILE_NOT_FOUND
@tobiasBlaser tobiasBlaser added the type: bug 🐛 Something isn't working label Apr 17, 2024
@jeripeierSBB
Copy link
Contributor

Hi @tobiasBlaser

The sbb-image is basically a helper for consuming images from the SBB image CDN. For your case, I recommned to use a normal tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants