From: Chocobozzz Date: Thu, 28 Dec 2017 07:49:08 +0000 (+0100) Subject: Fix preview 404 X-Git-Tag: v0.0.1-alpha~81 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f40bbe3146553ef45515ee6b6d93ce6028f045ca;p=oweals%2Fpeertube.git Fix preview 404 --- diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index ded854ee1..83f3e9933 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts @@ -22,7 +22,9 @@ function fetchRemoteVideoPreview (video: VideoModel, reject: Function) { const host = video.VideoChannel.Account.Actor.Server.host const path = join(STATIC_PATHS.PREVIEWS, video.getPreviewName()) - return request.get(REMOTE_SCHEME.HTTP + '://' + host + path, err => reject(err)) + return request.get(REMOTE_SCHEME.HTTP + '://' + host + path, err => { + if (err) reject(err) + }) } async function fetchRemoteVideoDescription (video: VideoModel) { diff --git a/server/lib/cache/videos-preview-cache.ts b/server/lib/cache/videos-preview-cache.ts index ea959076d..930298dbe 100644 --- a/server/lib/cache/videos-preview-cache.ts +++ b/server/lib/cache/videos-preview-cache.ts @@ -56,7 +56,6 @@ class VideosPreviewCache { } private saveRemotePreviewAndReturnPath (video: VideoModel) { - return new Promise((res, rej) => { const req = fetchRemoteVideoPreview(video, rej) const path = join(CACHE.DIRECTORIES.PREVIEWS, video.getPreviewName())