From f4342083d09013787cbcc531b41e44a28ba57595 Mon Sep 17 00:00:00 2001 From: Xavier Decoster Date: Wed, 3 May 2017 22:34:01 +0200 Subject: [PATCH] #3861 V2 NuGetEntityTypeSerializer Id link patcher must retain curated feed name (#3864) --- .../OData/Serializers/NuGetEntityTypeSerializer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NuGetGallery/OData/Serializers/NuGetEntityTypeSerializer.cs b/src/NuGetGallery/OData/Serializers/NuGetEntityTypeSerializer.cs index 5d9349338c..a5a48e67aa 100644 --- a/src/NuGetGallery/OData/Serializers/NuGetEntityTypeSerializer.cs +++ b/src/NuGetGallery/OData/Serializers/NuGetEntityTypeSerializer.cs @@ -100,7 +100,7 @@ private void TryAnnotateV2FeedPackage(ODataEntry entry, EntityInstanceContext en private static void NormalizeNavigationLinks(ODataEntry entry, HttpRequestMessage request, V2FeedPackage instance, string normalizedVersion) { - var idLink = BuildIdLink("v2", instance.Id, normalizedVersion, request); + var idLink = BuildIdLink(instance.Id, normalizedVersion, request); if (entry.ReadLink != null) { @@ -135,9 +135,9 @@ private static Uri BuildLinkForStreamProperty(string routePrefix, string id, str return builder.Uri; } - private static Uri BuildIdLink(string routePrefix, string id, string version, HttpRequestMessage request) + private static Uri BuildIdLink(string id, string version, HttpRequestMessage request) { - return new Uri($"{request.RequestUri.Scheme}://{request.RequestUri.Host}/api/{routePrefix}/Packages(Id='{id}',Version='{version}')"); + return new Uri($"{request.RequestUri.Scheme}://{request.RequestUri.Host}{request.RequestUri.LocalPath}(Id='{id}',Version='{version}')"); } private static string EnsureTrailingSlash(string url)