From d2ec7ccd2e37c4265037a694b2f748b994b65d53 Mon Sep 17 00:00:00 2001
From: Sergio Zharinov <zharinov@users.noreply.github.com>
Date: Thu, 3 Sep 2020 10:37:15 +0400
Subject: [PATCH] fix(nuget): Fix cache key and URL construction (#7169)

---
 lib/datasource/nuget/index.ts | 2 +-
 lib/datasource/nuget/v3.ts    | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/datasource/nuget/index.ts b/lib/datasource/nuget/index.ts
index 8280694c0e..ce55ae6b29 100644
--- a/lib/datasource/nuget/index.ts
+++ b/lib/datasource/nuget/index.ts
@@ -41,7 +41,7 @@ export async function getReleases({
   }
   if (protocolVersion === 3) {
     const queryUrl = await v3.getResourceUrl(feedUrl);
-    if (queryUrl !== null) {
+    if (queryUrl) {
       return v3.getReleases(feedUrl, queryUrl, lookupName);
     }
   }
diff --git a/lib/datasource/nuget/v3.ts b/lib/datasource/nuget/v3.ts
index 52db9e9d4a..f08b8594ae 100644
--- a/lib/datasource/nuget/v3.ts
+++ b/lib/datasource/nuget/v3.ts
@@ -51,7 +51,7 @@ export async function getResourceUrl(
       servicesIndexRaw = (await http.getJson<ServicesIndexRaw>(url)).body;
       await packageCache.set(
         cacheNamespace,
-        resultCacheKey,
+        responseCacheKey,
         servicesIndexRaw,
         3 * 24 * 60
       );
@@ -122,7 +122,8 @@ export async function getReleases(
   feedUrl: string,
   pkgName: string
 ): Promise<ReleaseResult | null> {
-  const url = `${feedUrl.replace(/\/*$/, '')}/${pkgName}/index.json`;
+  const baseUrl = feedUrl.replace(/\/*$/, '');
+  const url = `${baseUrl}/${pkgName.toLowerCase()}/index.json`;
   const packageRegistration = await http.getJson<PackageRegistration>(url);
   const catalogPages = packageRegistration.body.items || [];
   const catalogPagesQueue = catalogPages.map((page) => (): Promise<
-- 
GitLab