aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/search.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/search.ts')
-rw-r--r--server/controllers/api/search.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts
index 28a7a04ca..fd4db7a54 100644
--- a/server/controllers/api/search.ts
+++ b/server/controllers/api/search.ts
@@ -56,6 +56,9 @@ function searchVideoChannels (req: express.Request, res: express.Response) {
56 const isURISearch = search.startsWith('http://') || search.startsWith('https://') 56 const isURISearch = search.startsWith('http://') || search.startsWith('https://')
57 57
58 const parts = search.split('@') 58 const parts = search.split('@')
59
60 // Handle strings like @toto@example.com
61 if (parts.length === 3 && parts[0].length === 0) parts.shift()
59 const isWebfingerSearch = parts.length === 2 && parts.every(p => p.indexOf(' ') === -1) 62 const isWebfingerSearch = parts.length === 2 && parts.every(p => p.indexOf(' ') === -1)
60 63
61 if (isURISearch || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res) 64 if (isURISearch || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res)
@@ -86,7 +89,7 @@ async function searchVideoChannelURI (search: string, isWebfingerSearch: boolean
86 89
87 if (isUserAbleToSearchRemoteURI(res)) { 90 if (isUserAbleToSearchRemoteURI(res)) {
88 try { 91 try {
89 const actor = await getOrCreateActorAndServerAndModel(uri, true, true) 92 const actor = await getOrCreateActorAndServerAndModel(uri, 'all', true, true)
90 videoChannel = actor.VideoChannel 93 videoChannel = actor.VideoChannel
91 } catch (err) { 94 } catch (err) {
92 logger.info('Cannot search remote video channel %s.', uri, { err }) 95 logger.info('Cannot search remote video channel %s.', uri, { err })
@@ -136,7 +139,7 @@ async function searchVideoURI (url: string, res: express.Response) {
136 refreshVideo: false 139 refreshVideo: false
137 } 140 }
138 141
139 const result = await getOrCreateVideoAndAccountAndChannel(url, syncParam) 142 const result = await getOrCreateVideoAndAccountAndChannel({ videoObject: url, syncParam })
140 video = result ? result.video : undefined 143 video = result ? result.video : undefined
141 } catch (err) { 144 } catch (err) {
142 logger.info('Cannot search remote video %s.', url, { err }) 145 logger.info('Cannot search remote video %s.', url, { err })