refactor
This commit is contained in:
parent
510817aad4
commit
d57f5d26a5
|
@ -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');
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue