swisspost / design-system

The Swiss Post Design System pattern library for a consistent and accessible user experience across the web platform.
https://design-system.post.ch
Apache License 2.0
106 stars 13 forks source link

User-Icon is not loading within intranet header #1995

Closed riscie closed 6 months ago

riscie commented 7 months ago

Hi swisspost design system team

With the newest version of swiss post design system, we currently have the issue, that the user image within the intranet header is not loading.

image

It seems to be a CORS issue. image image

When I manually open the link to the image in a new tab, the image is loaded.

Any feedback / help is appreciated.

### Tasks
- [x] https://github.com/swisspost/design-system/issues/2173
- [x] createSafeAvatarUrl returns a "*/.png" URL
riscie commented 7 months ago

Hi @alizedebray. Regarding your label. We have this problem with the intranet-header, not sure if it's also occurring with internet-header.

riscie commented 7 months ago

@alizedebray I took some time and skimmed the code.

To me, it looks like this check is wrong. We are only checking for null, but the default value of currentUserId is an empty-string. If I see this correctly, after fixing this if-check, the image should take the hardcoded base64 string from user.ts, if currentUserId is not present. At the moment we try to load a file with the name ".png" in this case.

Let me know if you want me to create a PR, I am happy to help.

mkeller1992 commented 7 months ago

We have the exact same problems in our apps actually. I hope this issue will be taken care of soon.

riscie commented 6 months ago

Any news on this? @alizedebray

alizedebray commented 6 months ago

@riscie Thanks for your inputs, I just merged the changes you suggested which should help with the default user image being displayed correctly. The fix should be release in the coming week.

However, you might still encounter CORS errors with actual user images. I created another ticket to track this issue: #2173.

riscie commented 6 months ago

Thank you @alizedebray I will try to make some tests with the new version this week.

riscie commented 5 months ago

It works with the default user image @alizedebray.