From e5cf41ea6a4813b422a02320f5569ac2fa39c391 Mon Sep 17 00:00:00 2001 From: Nathan Vogel Date: Sat, 22 Feb 2020 13:00:35 +0100 Subject: [PATCH] Fix #86 replace all matches in RELEASES (#87) --- lib/cache.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/cache.js b/lib/cache.js index 65c5c68..4d297cf 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -58,7 +58,7 @@ module.exports = class Cache { { retries: 3 } ) - const content = await convertStream(body) + let content = await convertStream(body) const matches = content.match(/[^ ]*\.nupkg/gim) if (matches.length === 0) { @@ -67,8 +67,11 @@ module.exports = class Cache { ) } - const nuPKG = url.replace('RELEASES', matches[0]) - return content.replace(matches[0], nuPKG) + for (let i = 0; i < matches.length; i += 1) { + const nuPKG = url.replace('RELEASES', matches[i]) + content = content.replace(matches[i], nuPKG) + } + return content } async refreshCache() {