refactor(fase1b): unify upload/download via use-case + proxy download
- upload-file use-case is now the single save path with dedup policy (hash / bucket-key / none), partPrefix + signatureBuffer inputs, fileHash in UploadOutput, and owned temp-file cleanup; pass temp path (not open stream) to telegram service for testability - upload-controller (multipart + JSON) and web-api upload delegate to the use-case; JSON body via JsonUploadPayloadSchema; responses built from use-case output via buildUploadResponse - web-api download 302 redirect -> proxy stream (closes bot_token leak); shared CORS + sanitizeFilenameHeader - file-controller drops double file-info cache layer (pool caches) - bot handler uses DI singletons instead of direct construction - get-file RedirectRetrieval.redirectUrl marked deprecated, URL via shared builder; chunked-storage URL via buildTelegramFileUrl (no inline api.telegram.org/file/bot left in src/)
This commit is contained in:
1 parent
7d5b8154a4
commit
bd4cf8b285
8 files changed
+292
-391
No files matched your search
@@ -12,6 +12,7 @@ import type { RangeParseResult } from '../../interfaces/s3/range';
|
||||
import { type CompressionAlgorithm, maybeCompressChunk } from '../../shared/utils/compress';
|
||||
import { computeHash } from '../../shared/utils/file';
|
||||
import { asSafeChunkSize } from '../../shared/utils/validation';
|
||||
import { buildTelegramFileUrl } from './file-url';
|
||||
|
||||
/**
|
||||
* Metadata about a single uploaded chunk (part) stored in Telegram.
|
||||
@@ -237,7 +238,7 @@ export class ChunkedStorage {
|
||||
const fileInfo = await this.telegramService.getFileInfo(part.telegramFileId);
|
||||
return {
|
||||
part,
|
||||
url: `https://api.telegram.org/file/bot${fileInfo.bot_token}/${fileInfo.file_path}`,
|
||||
url: buildTelegramFileUrl(fileInfo.file_path, fileInfo.bot_token),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user