This commit is contained in:
tamaina 2023-01-15 15:27:08 +00:00
parent 510817aad4
commit d57f5d26a5
3 changed files with 3 additions and 5 deletions

View File

@ -79,7 +79,7 @@ export class DownloadService {
@bindThis
public async pipeRequestToFile(_response: Response, path: string): Promise<void> {
const response = _response.clone();
if (response.body === null) {
if (response.body == null) {
throw new StatusError('No body', 400, 'No body');
}

View File

@ -108,8 +108,7 @@ export class FileServerService {
if (file.isLink && file.uri) { // 期限切れリモートファイル
const [path, cleanup] = await createTemp();
try {
const _response = await this.downloadService.fetchUrl(file.uri);;
const response = _response.clone() as NonNullBodyResponse;
const response = await this.downloadService.fetchUrl(file.uri);
const fileSaving = this.downloadService.pipeRequestToFile(response, path);
let { mime, ext } = await this.fileInfoService.detectRequestType(response);

View File

@ -74,8 +74,7 @@ export class MediaProxyServerService {
// Create temp file
const [path, cleanup] = await createTemp();
try {
const _response = await this.downloadService.fetchUrl(url);
const response = _response.clone() as NonNullBodyResponse;
const response = await this.downloadService.fetchUrl(url);
const fileSaving = this.downloadService.pipeRequestToFile(response, path);
let { mime, ext } = await this.fileInfoService.detectRequestType(response);