From 1836179ada14a0aa3311239504c5f4ddaa33505b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Tue, 19 Apr 2022 21:25:26 +0200 Subject: [PATCH] wikidata.getAbstract(): include language in cacheId --- src/wikipedia.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/wikipedia.js b/src/wikipedia.js index d99cf851..ff80c381 100644 --- a/src/wikipedia.js +++ b/src/wikipedia.js @@ -102,9 +102,10 @@ function get (value, callback) { } function getAbstract (value, callback) { - if (value in getAbstractCache) { - callback(null, getAbstractCache[value]) - return getAbstractCache[value] + const cacheId = options.data_lang + ':' + value + if (cacheId in getAbstractCache) { + callback(null, getAbstractCache[cacheId]) + return getAbstractCache[cacheId] } get(value, @@ -119,7 +120,7 @@ function getAbstract (value, callback) { text += ' ' + lang('more') + '' } - getAbstractCache[value] = text + getAbstractCache[cacheId] = text callback(err, text) } @@ -418,8 +419,9 @@ module.exports = { } OverpassLayer.twig.extendFilter('wikipediaAbstract', function (value, param) { - if (value in getAbstractCache) { - let result = getAbstractCache[value] + const cacheId = options.data_lang + ':' + value + if (cacheId in getAbstractCache) { + let result = getAbstractCache[cacheId] return '
' + result + '
' }