Fix embed video id parsing
authorChocobozzz <me@florianbigard.com>
Thu, 15 Nov 2018 15:57:59 +0000 (16:57 +0100)
committerChocobozzz <me@florianbigard.com>
Thu, 15 Nov 2018 15:57:59 +0000 (16:57 +0100)
client/src/standalone/videos/embed.ts
server/lib/job-queue/handlers/video-views.ts

index c113c67da3095d9a5e5d4d341f45c76e62387f48..7daa03f23b631058ba2ea0aab641c17c4b390b89 100644 (file)
@@ -256,9 +256,8 @@ class PeerTubeEmbed {
   }
 
   private async initCore () {
-    const urlParts = window.location.href.split('/')
-    const lastPart = urlParts[ urlParts.length - 1 ]
-    const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ]
+    const urlParts = window.location.pathname.split('/')
+    const videoId = urlParts[ urlParts.length - 1 ]
 
     const [ , serverTranslations, videoResponse, captionsResponse ] = await Promise.all([
       loadLocaleInVideoJS(window.location.origin, vjs, navigator.language),
index 2ceec2342c70859a87f83f8896370b2d81c819c8..f44c3c7276e43c4e5dd098c791c2f00903cfd29f 100644 (file)
@@ -39,7 +39,7 @@ async function processVideosViews () {
           })
 
           const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId)
-          await federateVideoIfNeeded(video, false)
+          if (video.isOwned()) await federateVideoIfNeeded(video, false)
         } catch (err) {
           logger.debug('Cannot create video views for video %d in hour %d. Maybe the video does not exist anymore?', videoId, hour)
         }