diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-05 14:11:19 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-05 14:11:19 +0100 |
commit | dedcd583b2461895f816c3dd67d56f05d3274f6b (patch) | |
tree | 058880eda468f4282cefce275451aa76567a15b8 /server/controllers/api/search/search-video-channels.ts | |
parent | 3233acdadf34045b51da91d42bcd6b3cbf3036f4 (diff) | |
download | PeerTube-dedcd583b2461895f816c3dd67d56f05d3274f6b.tar.gz PeerTube-dedcd583b2461895f816c3dd67d56f05d3274f6b.tar.zst PeerTube-dedcd583b2461895f816c3dd67d56f05d3274f6b.zip |
Fix remote interaction
When we fetch a ressource that is a redirection of another ressource
Diffstat (limited to 'server/controllers/api/search/search-video-channels.ts')
-rw-r--r-- | server/controllers/api/search/search-video-channels.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/controllers/api/search/search-video-channels.ts b/server/controllers/api/search/search-video-channels.ts index c9e81bffa..aa5afb46e 100644 --- a/server/controllers/api/search/search-video-channels.ts +++ b/server/controllers/api/search/search-video-channels.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 { pickSearchChannelQuery } from '@server/helpers/query' | 3 | import { pickSearchChannelQuery } 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 { Hooks } from '@server/lib/plugins/hooks' | 7 | import { Hooks } from '@server/lib/plugins/hooks' |
@@ -126,7 +126,9 @@ async function searchVideoChannelURI (search: string, isWebfingerSearch: boolean | |||
126 | 126 | ||
127 | if (isUserAbleToSearchRemoteURI(res)) { | 127 | if (isUserAbleToSearchRemoteURI(res)) { |
128 | try { | 128 | try { |
129 | const actor = await getOrCreateAPActor(uri, 'all', true, true) | 129 | const latestUri = await findLatestRedirection(uri, { activityPub: true }) |
130 | |||
131 | const actor = await getOrCreateAPActor(latestUri, 'all', true, true) | ||
130 | videoChannel = actor.VideoChannel | 132 | videoChannel = actor.VideoChannel |
131 | } catch (err) { | 133 | } catch (err) { |
132 | logger.info('Cannot search remote video channel %s.', uri, { err }) | 134 | logger.info('Cannot search remote video channel %s.', uri, { err }) |