diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-caption.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts index 9920dfc7c..5a1becc47 100644 --- a/server/models/video/video-caption.ts +++ b/server/models/video/video-caption.ts | |||
@@ -75,14 +75,18 @@ export class VideoCaptionModel extends Model<VideoCaptionModel> { | |||
75 | 75 | ||
76 | @BeforeDestroy | 76 | @BeforeDestroy |
77 | static async removeFiles (instance: VideoCaptionModel) { | 77 | static async removeFiles (instance: VideoCaptionModel) { |
78 | if (!instance.Video) { | ||
79 | instance.Video = await instance.$get('Video') as VideoModel | ||
80 | } | ||
78 | 81 | ||
79 | if (instance.isOwned()) { | 82 | if (instance.isOwned()) { |
80 | if (!instance.Video) { | ||
81 | instance.Video = await instance.$get('Video') as VideoModel | ||
82 | } | ||
83 | |||
84 | logger.debug('Removing captions %s of video %s.', instance.Video.uuid, instance.language) | 83 | logger.debug('Removing captions %s of video %s.', instance.Video.uuid, instance.language) |
85 | return instance.removeCaptionFile() | 84 | |
85 | try { | ||
86 | await instance.removeCaptionFile() | ||
87 | } catch (err) { | ||
88 | logger.error('Cannot remove caption file of video %s.', instance.Video.uuid) | ||
89 | } | ||
86 | } | 90 | } |
87 | 91 | ||
88 | return undefined | 92 | return undefined |