From 2d0ee54a1295245b8c207da554b91ff2e17b1d13 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Fri, 24 Feb 2017 12:06:09 +0200 Subject: [PATCH] [Minor] URL tags: fix restoring of tags --- src/plugins/lua/url_tags.lua | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/plugins/lua/url_tags.lua b/src/plugins/lua/url_tags.lua index 4718d23d2..346e5a11a 100644 --- a/src/plugins/lua/url_tags.lua +++ b/src/plugins/lua/url_tags.lua @@ -283,22 +283,24 @@ local function tags_restore(task) for i = 1, d_len do if type(data[i]) == 'string' then local tld = tld_reverse[i] - for time, tag, meta in string.gmatch(data[i], '(%d+)|([^|]+)|(.+)') do - if (time + settings.expire) > now then - local metatags = {} - for m in string.gmatch(meta, '[^,]+') do - table.insert(metatags, m) - end - for _, idx in ipairs(tlds[tld]) do - if not tracking[tld] then - tracking[tld] = {} - end - if not tracking[tld][tag] then - tracking[tld][tag] = {} + for goo in string.gmatch(data[i], '[^/]+') do + for time, tag, meta in string.gmatch(goo, '(%d+)|([^|]+)|(.+)') do + if (time + settings.expire) > now then + local metatags = {} + for m in string.gmatch(meta, '[^,]+') do + table.insert(metatags, m) end - for _, ttag in ipairs(metatags) do - urls[idx]:add_tag(tag, ttag, mpool) - tracking[tld][tag][ttag] = true + for _, idx in ipairs(tlds[tld]) do + if not tracking[tld] then + tracking[tld] = {} + end + if not tracking[tld][tag] then + tracking[tld][tag] = {} + end + for _, ttag in ipairs(metatags) do + urls[idx]:add_tag(tag, ttag, mpool) + tracking[tld][tag][ttag] = true + end end end end -- 2.39.5