- // FIXME: use URL
- const remoteStaticPath = join(STATIC_PATHS.PREVIEWS, video.getPreview().filename)
- const destPath = join(FILES_CACHE.PREVIEWS.DIRECTORY, video.getPreview().filename)
+ const preview = video.getPreview()
+ const destPath = join(FILES_CACHE.PREVIEWS.DIRECTORY, preview.filename)
+ const remoteUrl = preview.getFileUrl(video)
+
+ try {
+ await doRequestAndSaveToFile(remoteUrl, destPath)
+
+ logger.debug('Fetched remote preview %s to %s.', remoteUrl, destPath)