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) { 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')