Skip to content

Conversation

hosswald
Copy link
Contributor

@hosswald hosswald commented Sep 7, 2022

add a sanitized version of the hostname (replace any character matching [^a-zA-Z0-9\-.] with underscore)
fixes #240

@cjimti
Copy link
Member

cjimti commented Sep 8, 2022

@hosswald, thanks for the PR. However, if we do this, we should use - (dash) to stick with the DNS standard for hostnames.

https://en.wikipedia.org/wiki/Hostname

In addition, it should strip any leading or trailing -,

@hosswald
Copy link
Contributor Author

hosswald commented Sep 12, 2022

@cjimti changed it. Now everything that is not alphanumeric is replaced with dash, and leading/trailing dashes are stripped. Please review.
Note: I did not consider that people might have umlauts or even non-latin context names, what do you think about that?

…placed with dash

* leading and trailing dashes are stripped
* added test
txn2#240
@cjimti
Copy link
Member

cjimti commented Sep 13, 2022

I think this helps the majority of people in your situation. I don't know that umlauts/emoji, etc are a problem, but this is a good start. Thanks

@cjimti cjimti merged commit 8eca9de into txn2:master Sep 13, 2022
D3-LucaPiombino pushed a commit to CodeCoil/kubefwd that referenced this pull request Jun 13, 2024
add a sanitized version of the hostname (replace any character matchi…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context names with special characters break generated hostnames
2 participants