diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-20 16:24:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-20 16:24:31 +0200 |
commit | 0491173a61aed66205c017e0d7e0503ea316c144 (patch) | |
tree | ce6621597505f9518cfdf0981977d097c63f9fad /server/controllers/api/search.ts | |
parent | 8704acf49efc770d73bf07c10468ed8c74d28a83 (diff) | |
parent | 6247b2057b792cea155a1abd9788c363ae7d2cc2 (diff) | |
download | PeerTube-0491173a61aed66205c017e0d7e0503ea316c144.tar.gz PeerTube-0491173a61aed66205c017e0d7e0503ea316c144.tar.zst PeerTube-0491173a61aed66205c017e0d7e0503ea316c144.zip |
Merge branch 'develop' into cli-wrapper
Diffstat (limited to 'server/controllers/api/search.ts')
-rw-r--r-- | server/controllers/api/search.ts | 7 |
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 }) |