fix(feed): fix check adding record on info table

This commit is contained in:
Alexey Kasyanchuk 2018-08-19 19:43:46 +03:00
parent fe33d2d400
commit 4dfd5cd15a
2 changed files with 15 additions and 3 deletions

View File

@ -51,10 +51,11 @@ const expand = (sphinx) => {
continue; continue;
if(typeof values[val] == 'object') if(typeof values[val] == 'object')
values[val] = JSON.stringify(values[val]) valuesData += sphinx.escape(JSON.stringify(values[val])) + ',';
else
valuesData += sphinx.escape(values[val]) + ',';
names += '`' + val + '`,'; names += '`' + val + '`,';
valuesData += sphinx.escape(values[val]) + ',';
} }
names = names.slice(0, -1) names = names.slice(0, -1)
valuesData = valuesData.slice(0, -1) valuesData = valuesData.slice(0, -1)

View File

@ -414,6 +414,16 @@ module.exports = function (send, recive, dataDirectory, version, env)
delete torrent.contenttype; delete torrent.contenttype;
} }
if(torrent.info && typeof torrent.info == 'string')
{
try {
torrent.info = JSON.parse(torrent.info)
} catch(err) {
logT('add', 'problem with info torrent parse for torrent', torrent.name, 'just ignore')
delete torrent.info
}
}
// clean download info if added // clean download info if added
if(torrent.download) if(torrent.download)
delete torrent.download delete torrent.download
@ -529,6 +539,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
piecelength: torrent.piecelength, piecelength: torrent.piecelength,
contentType: torrent.contentType, contentType: torrent.contentType,
contentCategory: torrent.contentCategory, contentCategory: torrent.contentCategory,
info: torrent.info,
}); });
updateTorrentTrackers(torrent.hash); updateTorrentTrackers(torrent.hash);
remoteTrackers.update(torrent) remoteTrackers.update(torrent)