diff options
Diffstat (limited to 'server/models/video/video-file.ts')
-rw-r--r-- | server/models/video/video-file.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 4df2c20bc..1ad796104 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts | |||
@@ -457,18 +457,26 @@ export class VideoFileModel extends Model { | |||
457 | 457 | ||
458 | // We proxify torrent requests so use a local URL | 458 | // We proxify torrent requests so use a local URL |
459 | getTorrentUrl () { | 459 | getTorrentUrl () { |
460 | if (!this.torrentFilename) return null | ||
461 | |||
460 | return WEBSERVER.URL + this.getTorrentStaticPath() | 462 | return WEBSERVER.URL + this.getTorrentStaticPath() |
461 | } | 463 | } |
462 | 464 | ||
463 | getTorrentStaticPath () { | 465 | getTorrentStaticPath () { |
466 | if (!this.torrentFilename) return null | ||
467 | |||
464 | return join(LAZY_STATIC_PATHS.TORRENTS, this.torrentFilename) | 468 | return join(LAZY_STATIC_PATHS.TORRENTS, this.torrentFilename) |
465 | } | 469 | } |
466 | 470 | ||
467 | getTorrentDownloadUrl () { | 471 | getTorrentDownloadUrl () { |
472 | if (!this.torrentFilename) return null | ||
473 | |||
468 | return WEBSERVER.URL + join(STATIC_DOWNLOAD_PATHS.TORRENTS, this.torrentFilename) | 474 | return WEBSERVER.URL + join(STATIC_DOWNLOAD_PATHS.TORRENTS, this.torrentFilename) |
469 | } | 475 | } |
470 | 476 | ||
471 | removeTorrent () { | 477 | removeTorrent () { |
478 | if (!this.torrentFilename) return null | ||
479 | |||
472 | const torrentPath = getTorrentFilePath(this) | 480 | const torrentPath = getTorrentFilePath(this) |
473 | return remove(torrentPath) | 481 | return remove(torrentPath) |
474 | .catch(err => logger.warn('Cannot delete torrent %s.', torrentPath, { err })) | 482 | .catch(err => logger.warn('Cannot delete torrent %s.', torrentPath, { err })) |