aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-18 08:48:24 +0200
committerChocobozzz <me@florianbigard.com>2018-10-18 10:44:15 +0200
commite27ff5da6ed7bc1f56f50f862b80fb0c7d8a6d98 (patch)
tree81b45623621952bd75efa3f701e5a8bd37a50f03 /server/lib
parent244b4ae3973bc1511464a08158a123767f83179c (diff)
downloadPeerTube-e27ff5da6ed7bc1f56f50f862b80fb0c7d8a6d98.tar.gz
PeerTube-e27ff5da6ed7bc1f56f50f862b80fb0c7d8a6d98.tar.zst
PeerTube-e27ff5da6ed7bc1f56f50f862b80fb0c7d8a6d98.zip
AP mimeType -> mediaType
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/videos.ts9
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 {
310function isActivityVideoUrlObject (url: ActivityUrlObject): url is ActivityVideoUrlObject { 310function 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
316async function createVideo (videoObject: VideoTorrentObject, channelActor: ActorModel, waitThumbnail = false) { 317async 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,