From: Chocobozzz Date: Tue, 28 May 2019 07:36:46 +0000 (+0200) Subject: Fix crash in files cache X-Git-Tag: v1.3.0~4 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ff0bce13592da002a836caedf8daebcdd035260c;p=oweals%2Fpeertube.git Fix crash in files cache --- diff --git a/server/lib/files-cache/abstract-video-static-file-cache.ts b/server/lib/files-cache/abstract-video-static-file-cache.ts index 1908cfb06..c06355446 100644 --- a/server/lib/files-cache/abstract-video-static-file-cache.ts +++ b/server/lib/files-cache/abstract-video-static-file-cache.ts @@ -18,8 +18,8 @@ export abstract class AbstractVideoStaticFileCache { maxAge, max, promise: true, - dispose: (result: GetFilePathResult) => { - if (result.isOwned !== true) { + dispose: (result?: GetFilePathResult) => { + if (result && result.isOwned !== true) { remove(result.path) .then(() => logger.debug('%s removed from %s', result.path, this.constructor.name)) .catch(err => logger.error('Cannot remove %s from cache %s.', result.path, this.constructor.name, { err }))