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

Block emoji from being entered as a repo name #3090

Closed
tierninho opened this issue Oct 18, 2017 · 10 comments
Closed

Block emoji from being entered as a repo name #3090

tierninho opened this issue Oct 18, 2017 · 10 comments
Labels
bug Confirmed bugs or reports that are very likely to be bugs priority-3 Bugs that affect small number of users and/or relatively cosmetic in nature

Comments

@tierninho
Copy link
Contributor

Emoji shouldn't be allowed in place of a repo name as they are converted anyway to "normal" characters by GitHub.com and Desktop once published.

If you already have a repo with the namegithub.com/tierninho/-1 and you decide to create a new repo with an emoji 🐴 as the repo name, the name becomes converted to "normal" characters as expected. However, if you click "open in GitHub" or "create PR", the existing repo is opened despite the real url being github.com/tierninho/-

screen shot 2017-10-18 at 2 34 22 pm

screen shot 2017-10-18 at 2 35 27 pm

Just remove the Emoji option from the Edit menu?

tested 1.0.5beta0, mac

@tierninho tierninho added the bug Confirmed bugs or reports that are very likely to be bugs label Oct 18, 2017
@shiftkey
Copy link
Member

@tierninho so emoji (or non-UTF8 characters) in the repository name don't get rejected by the GitHub API? Is that accurate? What does the resulting dotcom repository home page look like?

@tierninho
Copy link
Contributor Author

@shiftkey

so emoji (or non-UTF8 characters) in the repository name don't get rejected by the GitHub API?

Correct, they don't get rejected as somewhere along the line, GitHub recognizes the special characters and converts them to - as so:

[AppStore] adding repository at /Users/tierninho/Documents/testing/testtnfnttttdfdfttttt/--x to store

What does the resulting dotcom repository home page look like?

Resulting page looks like: https://github.com/tierninho/-a1 for this

screen shot 2017-10-19 at 7 38 29 am

The controller test in GH/GH would return a 422 for dupes, but I couldn't trigger it for invalid names.

@cashwellcamc
Copy link

I've noticed they are still rendering on some accounts, though.

@Daniel-McCarthy
Copy link
Member

Daniel-McCarthy commented Oct 4, 2018

I was taking a look at this last night. If I understand correctly, the issue seems to be that although we sanitize names with the Create-Repository dialog, we do not do the same checks in the Publish-Repository dialog, which gives the user a chance to potentially put in characters like emojis?

It may be sufficient to include this sanitization behavior we do in the Create-Repository dialog in the Publish-Repository dialog as well.

Like this:
peek 2018-10-04 15-07

I would be happy to make a pull request for this. Otherwise I would love to understand this issue a little better and what other considerations need to be made.


Edit: Also, I noticed this while looking into this Issue:

/** Sanitize a proposed repository name by replacing illegal characters. */
export function sanitizedRepositoryName(name: string): string {
return name.replace(/[^\w.-]/g, '-')
}

It seems that GitHub.com allows repository names to have _ in addition to ., -, and the a-z 0-9 characters. The sanitization function filters out _. However, it appears GitHub.com does not. I don't see a documented reason in this file, so I was curious if there's some sort of other compatibility issue here.

@tierninho tierninho added the priority-3 Bugs that affect small number of users and/or relatively cosmetic in nature label Oct 11, 2018
@Daniel-McCarthy
Copy link
Member

@tierninho Would adding the repository name sanitization that occurs in the Create-Repository dialog to the Publish-Repository dialog be a sufficient solution for this issue?

If so, I have the changes required for this ready. I have extra details about this proposed solution in the comment above.

@outofambit
Copy link
Contributor

@Daniel-McCarthy that seems like a sensible approach to me. I'm not sure about the reasoning for filtering out _ so I think its best to preserve that behavior for now. thank you!

@Daniel-McCarthy
Copy link
Member

@outofambit Sounds great! I have the changes ready and will get a pull request ready soon.

I think its best to preserve that behavior for now.

I certainly agree. I was hoping that perhaps this might be an opportunity for some improved documentation to explain this, so I gave it a mention while it was relevant.

@ednl
Copy link

ednl commented Jul 30, 2020

I found this old thread, sorry. But I think this is relevant: the web interface for Create New Repo still allows emojis (and other "illegal" characters, presumably) and doesn't gave a hint that these will be converted to -.

I actually think they should be allowed (I mean, why not?) but until that is possible & agreed upon, it's probably simpler & cleaner & more obvious & thus better to apply the same sanitiser to the (new) repo name input in the web interface.

@shiftkey
Copy link
Member

the web interface for Create New Repo still allows emojis (and other "illegal" characters, presumably) and doesn't gave a hint that these will be converted to -.

This is what I see when I try and specify emoji on the /new page:

@ednl if you've found a different place on GitHub that isn't showing this behaviour, please share a screenshot or describe the steps to find it.

@ednl
Copy link

ednl commented Jul 30, 2020

Oh you are right, that does show. Sorry! (again). However, I think the reason I overlooked it is because the green checkmark in the textbox itself was more prominent to me.

Edit: in fact, I think I did see it but dismissed it because I did not understand its implication: "will be created as -". The green check that suggests all is well confuses the message. Like: "hm the name is good, so what is this created as -?". Obviously now I know.

That checkmark is deceiving; I am not sure that anyone typing certain characters on purpose which will be converted to "-", would agree that that is worth a green checkmark. The name, as typed, won't be accepted.

factotvm added a commit to factotvm/prr that referenced this issue Nov 29, 2022
Having a dot is supported in GitHub, while the `SHORT` regex is too
restrictive and disallows this. Support is added for repositories that
contain a period or full stop will work.

There is no definitive guide to allowed characters for GitHub
repositories, but you can piece together the allowed characters via
moby/moby#679 and desktop/desktop#3090.

Tests were also added that verified the allowed characters in the
repository name.
factotvm added a commit to factotvm/prr that referenced this issue Nov 29, 2022
Having a dot is supported in GitHub, while the `SHORT` regex is too
restrictive and disallows this. Support is added for repositories that
contain a period or full stop.

There is no definitive guide to allowed characters for GitHub
repositories, but you can piece together the allowed characters via
moby/moby#679 and desktop/desktop#3090.

Tests were also added that verified the allowed characters in the
repository name.
factotvm added a commit to factotvm/prr that referenced this issue Nov 30, 2022
Having a dot is supported in GitHub, while the `SHORT` regex is too
restrictive and disallows this. Support is added for repositories that
contain a period or full stop.

There is no definitive guide to allowed characters for GitHub
repositories, but you can piece together the allowed characters via
moby/moby#679 and desktop/desktop#3090.

Tests were also added that verified the allowed characters in the
repository name.
factotvm added a commit to factotvm/prr that referenced this issue Dec 2, 2022
Having a dot is supported in GitHub, while the `SHORT` regex is too
restrictive and disallows this. Support is added for repositories that
contain a period or full stop.

There is no definitive guide to allowed characters for GitHub
repositories, but you can piece together the allowed characters via
moby/moby#679 and desktop/desktop#3090.

Tests were also added that verified the allowed characters in the
repository name.
danobi pushed a commit to danobi/prr that referenced this issue Dec 2, 2022
Having a dot is supported in GitHub, while the `SHORT` regex is too
restrictive and disallows this. Support is added for repositories that
contain a period or full stop.

There is no definitive guide to allowed characters for GitHub
repositories, but you can piece together the allowed characters via
moby/moby#679 and desktop/desktop#3090.

Tests were also added that verified the allowed characters in the
repository name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs priority-3 Bugs that affect small number of users and/or relatively cosmetic in nature
Projects
None yet
Development

No branches or pull requests

6 participants