mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-08 20:37:41 +00:00
streamer: handling errors does not happen, add workaround
This commit is contained in:
@@ -138,7 +138,12 @@ export class AllFilesService {
|
|||||||
const entity = await this.fileRepository.findOne({ where: { id: id } });
|
const entity = await this.fileRepository.findOne({ where: { id: id } });
|
||||||
|
|
||||||
if (entity === null) {
|
if (entity === null) {
|
||||||
throw new NotFoundException('entity not found id: ' + fileId);
|
response
|
||||||
|
.status(404)
|
||||||
|
.send('entity not found id: ' + fileId)
|
||||||
|
.end();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.streamerFacade.streamFile(request, response, entity.path);
|
this.streamerFacade.streamFile(request, response, entity.path);
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ export class StreamerService {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const stats: Stats | false = await stat(filePath).catch(() => false);
|
const stats: Stats | false = await stat(filePath).catch(() => false);
|
||||||
if (stats === false) {
|
if (stats === false) {
|
||||||
throw new NotFoundException('file not found');
|
this.sendResponse(response, 404, {});
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const requestRange = this.requestRangeService.getRangeFromHeaders(
|
const requestRange = this.requestRangeService.getRangeFromHeaders(
|
||||||
|
|||||||
Reference in New Issue
Block a user