diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-07-04 14:53:13 -0400 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2025-07-27 17:57:30 +0100 |
| commit | df0331ea04b7db7eed1f975d3b13fe60f7e8a6ba (patch) | |
| tree | 80322f47d37d9308d7006c8bbdf9a517ce998bef | |
| parent | use shared URL verification in verifyLinkFields (diff) | |
| download | sharkey-df0331ea04b7db7eed1f975d3b13fe60f7e8a6ba.tar.gz sharkey-df0331ea04b7db7eed1f975d3b13fe60f7e8a6ba.tar.bz2 sharkey-df0331ea04b7db7eed1f975d3b13fe60f7e8a6ba.zip | |
verify URLs in DownloadService
| -rw-r--r-- | packages/backend/src/core/DownloadService.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/backend/src/core/DownloadService.ts b/packages/backend/src/core/DownloadService.ts index cb5bdb6cb7..d1819f40a3 100644 --- a/packages/backend/src/core/DownloadService.ts +++ b/packages/backend/src/core/DownloadService.ts @@ -19,6 +19,7 @@ import type Logger from '@/logger.js'; import { bindThis } from '@/decorators.js'; import { renderInlineError } from '@/misc/render-inline-error.js'; +import { UtilityService } from '@/core/UtilityService.js'; @Injectable() export class DownloadService { @@ -30,6 +31,7 @@ export class DownloadService { private httpRequestService: HttpRequestService, private loggerService: LoggerService, + private readonly utilityService: UtilityService, ) { this.logger = this.loggerService.getLogger('download'); } @@ -38,6 +40,8 @@ export class DownloadService { public async downloadUrl(url: string, path: string, options: { timeout?: number, operationTimeout?: number, maxSize?: number } = {} ): Promise<{ filename: string; }> { + this.utilityService.assertUrl(url); + this.logger.debug(`Downloading ${chalk.cyan(url)} to ${chalk.cyanBright(path)} ...`); const timeout = options.timeout ?? 30 * 1000; |