diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-11-11 15:24:36 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-11-16 20:29:26 +0100 |
commit | 55723d16fd0e323ce7175db8c4806c73d18b895d (patch) | |
tree | 19fd73503dd1504212e34639dfbf99455a241822 /server/models | |
parent | f285faa04e84b45e62bd05e7050dc500113b0356 (diff) | |
download | PeerTube-55723d16fd0e323ce7175db8c4806c73d18b895d.tar.gz PeerTube-55723d16fd0e323ce7175db8c4806c73d18b895d.tar.zst PeerTube-55723d16fd0e323ce7175db8c4806c73d18b895d.zip |
Server: adapt magnet uri search
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/video.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/models/video.js b/server/models/video.js index 19136ba25..4f2be5c96 100644 --- a/server/models/video.js +++ b/server/models/video.js | |||
@@ -299,7 +299,12 @@ function load (id, callback) { | |||
299 | function search (value, field, start, count, sort, callback) { | 299 | function search (value, field, start, count, sort, callback) { |
300 | const query = {} | 300 | const query = {} |
301 | // Make an exact search with the magnet | 301 | // Make an exact search with the magnet |
302 | if (field === 'magnetUri' || field === 'tags') { | 302 | if (field === 'magnetUri') { |
303 | const infoHash = magnetUtil.decode(value).infoHash | ||
304 | query.magnet = { | ||
305 | infoHash | ||
306 | } | ||
307 | } else if (field === 'tags') { | ||
303 | query[field] = value | 308 | query[field] = value |
304 | } else { | 309 | } else { |
305 | query[field] = new RegExp(value, 'i') | 310 | query[field] = new RegExp(value, 'i') |