[chore] better dns validation (#3644)

* add seperate PunifyValidate() function for properly validating domain names when converting to punycode

* rename function, strip port from domain validation
This commit is contained in:
kim 2025-01-14 14:23:18 +00:00 committed by GitHub
commit e77c7e16b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 203 additions and 173 deletions

View file

@ -137,8 +137,9 @@ func (a *accountDB) GetAccountByURL(ctx context.Context, url string) (*gtsmodel.
func (a *accountDB) GetAccountByUsernameDomain(ctx context.Context, username string, domain string) (*gtsmodel.Account, error) {
if domain != "" {
// Normalize the domain as punycode
var err error
// Normalize the domain as punycode
domain, err = util.Punify(domain)
if err != nil {
return nil, err