aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-file.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-25 11:30:00 +0200
committerChocobozzz <me@florianbigard.com>2021-05-25 11:34:43 +0200
commitbe89e66895948bb52b3f10186bcea1a8b92ef912 (patch)
tree47a4f5df534820b983df6d07fb76cf384ea197f2 /server/models/video/video-file.ts
parent6a3391bcede8e7a2bec83963221c112e6752b1a8 (diff)
downloadPeerTube-be89e66895948bb52b3f10186bcea1a8b92ef912.tar.gz
PeerTube-be89e66895948bb52b3f10186bcea1a8b92ef912.tar.zst
PeerTube-be89e66895948bb52b3f10186bcea1a8b92ef912.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.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts
index 1ad796104..0b5946149 100644
--- a/server/models/video/video-file.ts
+++ b/server/models/video/video-file.ts
@@ -401,6 +401,10 @@ export class VideoFileModel extends Model {
401 return VideoFileModel.destroy(options) 401 return VideoFileModel.destroy(options)
402 } 402 }
403 403
404 hasTorrent () {
405 return this.infoHash && this.torrentFilename
406 }
407
404 getVideoOrStreamingPlaylist (this: MVideoFileVideo | MVideoFileStreamingPlaylistVideo): MVideo | MStreamingPlaylistVideo { 408 getVideoOrStreamingPlaylist (this: MVideoFileVideo | MVideoFileStreamingPlaylistVideo): MVideo | MStreamingPlaylistVideo {
405 if (this.videoId) return (this as MVideoFileVideo).Video 409 if (this.videoId) return (this as MVideoFileVideo).Video
406 410