]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/thumbnail.ts
Merge branch 'release/v1.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / models / video / thumbnail.ts
index ec945893f6a408e6637411f016152b3bf1f68d86..8faf0adbaca2c3c8a6ff32335b8149e6156192a5 100644 (file)
@@ -42,7 +42,7 @@ export class ThumbnailModel extends Model<ThumbnailModel> {
 
   @AllowNull(true)
   @Column
-  url: string
+  fileUrl: string
 
   @ForeignKey(() => VideoModel)
   @Column
@@ -100,17 +100,19 @@ export class ThumbnailModel extends Model<ThumbnailModel> {
     return videoUUID + '.jpg'
   }
 
-  getUrl () {
-    if (this.url) return this.url
+  getFileUrl () {
+    if (this.fileUrl) return this.fileUrl
 
     const staticPath = ThumbnailModel.types[this.type].staticPath
     return WEBSERVER.URL + staticPath + this.filename
   }
 
-  removeThumbnail () {
+  getPath () {
     const directory = ThumbnailModel.types[this.type].directory
-    const thumbnailPath = join(directory, this.filename)
+    return join(directory, this.filename)
+  }
 
-    return remove(thumbnailPath)
+  removeThumbnail () {
+    return remove(this.getPath())
   }
 }