X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Ffiles-cache%2Fvideos-preview-cache.ts;h=dd3a84aca60a7c8fe5d0dbf7c6a3676bea57d3aa;hb=4e56f0fff12ab9840574e7a27277fc78b195b3e2;hp=51146d71843934ec4ce06605fc3d6b8245e9b54d;hpb=a8b1b40485145ac1eae513a661d7dd6e0986ce96;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/files-cache/videos-preview-cache.ts b/server/lib/files-cache/videos-preview-cache.ts index 51146d718..dd3a84aca 100644 --- a/server/lib/files-cache/videos-preview-cache.ts +++ b/server/lib/files-cache/videos-preview-cache.ts @@ -20,7 +20,7 @@ class VideosPreviewCache extends AbstractVideoStaticFileCache { } async getFilePathImpl (filename: string) { - const thumbnail = await ThumbnailModel.loadWithVideoByName(filename, ThumbnailType.PREVIEW) + const thumbnail = await ThumbnailModel.loadWithVideoByFilename(filename, ThumbnailType.PREVIEW) if (!thumbnail) return undefined if (thumbnail.Video.isOwned()) return { isOwned: true, path: thumbnail.getPath() } @@ -28,6 +28,7 @@ class VideosPreviewCache extends AbstractVideoStaticFileCache { return this.loadRemoteFile(thumbnail.Video.uuid) } + // Key is the video UUID protected async loadRemoteFile (key: string) { const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(key) if (!video) return undefined @@ -38,7 +39,7 @@ class VideosPreviewCache extends AbstractVideoStaticFileCache { const destPath = join(FILES_CACHE.PREVIEWS.DIRECTORY, preview.filename) const remoteUrl = preview.getFileUrl(video) - await doRequestAndSaveToFile({ uri: remoteUrl }, destPath) + await doRequestAndSaveToFile(remoteUrl, destPath) logger.debug('Fetched remote preview %s to %s.', remoteUrl, destPath)