Server: adapt magnet uri search

pull/24/head
Chocobozzz 2016-11-11 15:24:36 +01:00
parent f285faa04e
commit 55723d16fd
1 changed files with 6 additions and 1 deletions

View File

@ -299,7 +299,12 @@ function load (id, callback) {
function search (value, field, start, count, sort, callback) {
const query = {}
// Make an exact search with the magnet
if (field === 'magnetUri' || field === 'tags') {
if (field === 'magnetUri') {
const infoHash = magnetUtil.decode(value).infoHash
query.magnet = {
infoHash
}
} else if (field === 'tags') {
query[field] = value
} else {
query[field] = new RegExp(value, 'i')