diff options
Diffstat (limited to 'server/controllers/api/search/search-videos.ts')
-rw-r--r-- | server/controllers/api/search/search-videos.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/controllers/api/search/search-videos.ts b/server/controllers/api/search/search-videos.ts index 6db70acdf..68428d766 100644 --- a/server/controllers/api/search/search-videos.ts +++ b/server/controllers/api/search/search-videos.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { sanitizeUrl } from '@server/helpers/core-utils' | 2 | import { sanitizeUrl } from '@server/helpers/core-utils' |
3 | import { pickSearchVideoQuery } from '@server/helpers/query' | 3 | import { pickSearchVideoQuery } from '@server/helpers/query' |
4 | import { doJSONRequest } from '@server/helpers/requests' | 4 | import { doJSONRequest, findLatestRedirection } from '@server/helpers/requests' |
5 | import { CONFIG } from '@server/initializers/config' | 5 | import { CONFIG } from '@server/initializers/config' |
6 | import { WEBSERVER } from '@server/initializers/constants' | 6 | import { WEBSERVER } from '@server/initializers/constants' |
7 | import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' | 7 | import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' |
@@ -142,7 +142,10 @@ async function searchVideoURI (url: string, res: express.Response) { | |||
142 | refreshVideo: false | 142 | refreshVideo: false |
143 | } | 143 | } |
144 | 144 | ||
145 | const result = await getOrCreateAPVideo({ videoObject: url, syncParam }) | 145 | const result = await getOrCreateAPVideo({ |
146 | videoObject: await findLatestRedirection(url, { activityPub: true }), | ||
147 | syncParam | ||
148 | }) | ||
146 | video = result ? result.video : undefined | 149 | video = result ? result.video : undefined |
147 | } catch (err) { | 150 | } catch (err) { |
148 | logger.info('Cannot search remote video %s.', url, { err }) | 151 | logger.info('Cannot search remote video %s.', url, { err }) |