diff options
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/videos.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 54cea542f..3da363c0a 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -310,7 +310,8 @@ export { | |||
310 | function isActivityVideoUrlObject (url: ActivityUrlObject): url is ActivityVideoUrlObject { | 310 | function isActivityVideoUrlObject (url: ActivityUrlObject): url is ActivityVideoUrlObject { |
311 | const mimeTypes = Object.keys(VIDEO_MIMETYPE_EXT) | 311 | const mimeTypes = Object.keys(VIDEO_MIMETYPE_EXT) |
312 | 312 | ||
313 | return mimeTypes.indexOf(url.mimeType) !== -1 && url.mimeType.startsWith('video/') | 313 | const urlMediaType = url.mediaType || url.mimeType |
314 | return mimeTypes.indexOf(urlMediaType) !== -1 && urlMediaType.startsWith('video/') | ||
314 | } | 315 | } |
315 | 316 | ||
316 | async function createVideo (videoObject: VideoTorrentObject, channelActor: ActorModel, waitThumbnail = false) { | 317 | async function createVideo (videoObject: VideoTorrentObject, channelActor: ActorModel, waitThumbnail = false) { |
@@ -468,7 +469,8 @@ function videoFileActivityUrlToDBAttributes (video: VideoModel, videoObject: Vid | |||
468 | for (const fileUrl of fileUrls) { | 469 | for (const fileUrl of fileUrls) { |
469 | // Fetch associated magnet uri | 470 | // Fetch associated magnet uri |
470 | const magnet = videoObject.url.find(u => { | 471 | const magnet = videoObject.url.find(u => { |
471 | return u.mimeType === 'application/x-bittorrent;x-scheme-handler/magnet' && u.height === fileUrl.height | 472 | const mediaType = u.mediaType || u.mimeType |
473 | return mediaType === 'application/x-bittorrent;x-scheme-handler/magnet' && (u as any).height === fileUrl.height | ||
472 | }) | 474 | }) |
473 | 475 | ||
474 | if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.href) | 476 | if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.href) |
@@ -478,8 +480,9 @@ function videoFileActivityUrlToDBAttributes (video: VideoModel, videoObject: Vid | |||
478 | throw new Error('Cannot parse magnet URI ' + magnet.href) | 480 | throw new Error('Cannot parse magnet URI ' + magnet.href) |
479 | } | 481 | } |
480 | 482 | ||
483 | const mediaType = fileUrl.mediaType || fileUrl.mimeType | ||
481 | const attribute = { | 484 | const attribute = { |
482 | extname: VIDEO_MIMETYPE_EXT[ fileUrl.mimeType ], | 485 | extname: VIDEO_MIMETYPE_EXT[ mediaType ], |
483 | infoHash: parsed.infoHash, | 486 | infoHash: parsed.infoHash, |
484 | resolution: fileUrl.height, | 487 | resolution: fileUrl.height, |
485 | size: fileUrl.size, | 488 | size: fileUrl.size, |