]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-file.ts
Add banners support
[github/Chocobozzz/PeerTube.git] / server / models / video / video-file.ts
index 4df2c20bc4a3af908175cf886bcbf533147f6d2c..1ad79610414088d34b3221fd6c50ad23002a9777 100644 (file)
@@ -457,18 +457,26 @@ export class VideoFileModel extends Model {
 
   // We proxify torrent requests so use a local URL
   getTorrentUrl () {
+    if (!this.torrentFilename) return null
+
     return WEBSERVER.URL + this.getTorrentStaticPath()
   }
 
   getTorrentStaticPath () {
+    if (!this.torrentFilename) return null
+
     return join(LAZY_STATIC_PATHS.TORRENTS, this.torrentFilename)
   }
 
   getTorrentDownloadUrl () {
+    if (!this.torrentFilename) return null
+
     return WEBSERVER.URL + join(STATIC_DOWNLOAD_PATHS.TORRENTS, this.torrentFilename)
   }
 
   removeTorrent () {
+    if (!this.torrentFilename) return null
+
     const torrentPath = getTorrentFilePath(this)
     return remove(torrentPath)
       .catch(err => logger.warn('Cannot delete torrent %s.', torrentPath, { err }))