cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

When using EMOJI as username Avatar breaks πŸ’€

Open OmarMcAdam opened this issue 2 years ago β€’ 15 comments

Issue Summary

When the username is set to an emoji, the user's avatar fails to load. Looking at the network calls, it seems that the avatar is downloaded twice, with the version from Gravtar failing to load.

This could be due to the encoding of the emoji to gravtar url

Steps to Reproduce

  1. Set username to an emoji
  2. Avatar in account/public page is no longer loading

Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?

Only tested with single character (emoji) username https://cal.com/πŸ• Has not been tested with usernames with mixed alphanumeric + emoji (e.g. McPizzaπŸ•)

Technical details

N/A - applies across browsers

P.S. Very low priority

OmarMcAdam avatar Mar 14 '23 11:03 OmarMcAdam

ahhhh i know why. we add it to the route, as in https://app.cal.com/peer/avatar.png which means the emoji will cause issues.

should be a simple fix, we need to encode the emoji like the username: https://cal.com/%F0%9F%8D%95

correct URL would be:

https://app.cal.com/%F0%9F%8D%95/avatar.png

PeerRich avatar Mar 14 '23 11:03 PeerRich

@G3root wanna look into this?

PeerRich avatar Mar 14 '23 11:03 PeerRich

agree low priority

PeerRich avatar Mar 14 '23 11:03 PeerRich

i dont even know how many people use emojis as usernames. must be max. a handful

PeerRich avatar Mar 14 '23 11:03 PeerRich

Yup, very very rare use case, but could have implications elsewhere

Potentially a good first issue/contribution?

OmarMcAdam avatar Mar 14 '23 11:03 OmarMcAdam

Hi! I am new making contributions. I was taking a look at this issue, but I tried to change my username to an emoji or alphanumeric characters and when I confirm the change the emojis gets replaced by dashes "-". How can I reproduce this error?

jgimitola avatar Mar 16 '23 13:03 jgimitola

@jgimitola same here. it should be happening because of the slugify call. image

@McPizza0 can you still reproduce this issue?

abdallahalsamman avatar Apr 04 '23 07:04 abdallahalsamman

@McPizza0 can you still reproduce this issue?

Yes, still able to reproduce I'm using Cloud version with the following steps:

Go to Settings Enter πŸ• as username (Requires Premium and reserved usernames subscription) 1st save didnt work correctly (showed "--" as username after save) 2nd save worked Navigate to cal.com/πŸ• - Avatar is missing

p.s. please note that I now use the username /mc due to this and other issues

OmarMcAdam avatar Apr 04 '23 08:04 OmarMcAdam

@McPizza0 I can't test it out on prod since I don't have a premium account.

abdallahalsamman avatar Apr 07 '23 13:04 abdallahalsamman

@PeerRich while setting the username we need to encode the emoji ?

ygpta avatar Apr 23 '23 10:04 ygpta

we have 771 open issues, if someone wants to fix this, go for it. but i dont think this is of priority enough to fix :(

PeerRich avatar Apr 24 '23 21:04 PeerRich

Hi, @PeerRich I think encoding emojis would be a nice one, But I suggest that we put validations to only allow combinations of name and numbers usernames what do you think?

bhumit070 avatar Apr 29 '23 19:04 bhumit070

Hey I am thinking to modify the slugify regex to update the emoji, it is working local. Working on getting a PR ready.

cc: @PeerRich

pranjalg13 avatar May 07 '23 14:05 pranjalg13

@AyushMainali123 can we ensure if there is an open pr for an issue not to raise another one πŸ‘ ?

pranjalg13 avatar May 07 '23 15:05 pranjalg13

@PeerRich How about just blocking emoji's from the name? People who have it can keep, but new ones won't work. Zod recently introduced string().emoji() Perhaps we can do some Zod validation on the input to check if it contains an emoji, and if it does, fail the parsing?

OmarMcAdam avatar May 07 '23 17:05 OmarMcAdam