diff options
| author | dakkar <dakkar@thenautilus.net> | 2024-11-24 13:51:44 +0000 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2024-11-29 11:39:18 +0000 |
| commit | 82376f312d2286b8acf8baf5c652ac08e6b10390 (patch) | |
| tree | 1f94320d9184e8247afa2c529f430d5cbae8430c /packages/backend/src/core/UtilityService.ts | |
| parent | silence linter? (diff) | |
| download | sharkey-82376f312d2286b8acf8baf5c652ac08e6b10390.tar.gz sharkey-82376f312d2286b8acf8baf5c652ac08e6b10390.tar.bz2 sharkey-82376f312d2286b8acf8baf5c652ac08e6b10390.zip | |
use "userland" `punycode`, plus tests
thanks to CenTdemeern1 for the `import` incantation
Diffstat (limited to 'packages/backend/src/core/UtilityService.ts')
| -rw-r--r-- | packages/backend/src/core/UtilityService.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/backend/src/core/UtilityService.ts b/packages/backend/src/core/UtilityService.ts index c84e7f212b..fca715164e 100644 --- a/packages/backend/src/core/UtilityService.ts +++ b/packages/backend/src/core/UtilityService.ts @@ -4,7 +4,7 @@ */ import { URL } from 'node:url'; -import { toASCII } from 'punycode'; +import punycode from 'punycode/'; import { Inject, Injectable } from '@nestjs/common'; import RE2 from 're2'; import psl from 'psl'; @@ -107,13 +107,13 @@ export class UtilityService { @bindThis public toPuny(host: string): string { - return toASCII(host.toLowerCase()); + return punycode.toASCII(host.toLowerCase()); } @bindThis public toPunyNullable(host: string | null | undefined): string | null { if (host == null) return null; - return toASCII(host.toLowerCase()); + return punycode.toASCII(host.toLowerCase()); } @bindThis |