diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-25 11:30:00 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-25 11:35:29 +0200 |
commit | c4d125527a433db9ba536bf3bb8ef19569a85a73 (patch) | |
tree | a05d388e047d3088eb037489919b64dd497981ac /server/models/video/video-file.ts | |
parent | 3dc8a86c80a6d2fbcf4c7c02a31c1c60c8e6b598 (diff) | |
download | PeerTube-c4d125527a433db9ba536bf3bb8ef19569a85a73.tar.gz PeerTube-c4d125527a433db9ba536bf3bb8ef19569a85a73.tar.zst PeerTube-c4d125527a433db9ba536bf3bb8ef19569a85a73.zip |
Avoid error when file has no torrent file
Diffstat (limited to 'server/models/video/video-file.ts')
-rw-r--r-- | server/models/video/video-file.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index e3fa2f3d2..22cf63804 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts | |||
@@ -402,6 +402,10 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel> | |||
402 | return VideoFileModel.destroy(options) | 402 | return VideoFileModel.destroy(options) |
403 | } | 403 | } |
404 | 404 | ||
405 | hasTorrent () { | ||
406 | return this.infoHash && this.torrentFilename | ||
407 | } | ||
408 | |||
405 | getVideoOrStreamingPlaylist (this: MVideoFileVideo | MVideoFileStreamingPlaylistVideo): MVideo | MStreamingPlaylistVideo { | 409 | getVideoOrStreamingPlaylist (this: MVideoFileVideo | MVideoFileStreamingPlaylistVideo): MVideo | MStreamingPlaylistVideo { |
406 | if (this.videoId) return (this as MVideoFileVideo).Video | 410 | if (this.videoId) return (this as MVideoFileVideo).Video |
407 | 411 | ||