Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenba committed Aug 12, 2015
2 parents 904a36d + d3aa76c commit e01abfa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
7 changes: 6 additions & 1 deletion build.msbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll">
<PropertyGroup>
<MsBuildTasksAssembly Condition="Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll')">$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll</MsBuildTasksAssembly>
<MsBuildTasksAssembly Condition="Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll')">$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll</MsBuildTasksAssembly>
</PropertyGroup>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MsBuildTasksAssembly)">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ private static bool ShouldTryOther(Exception ex)

private static bool ShouldTryOther(HttpResponseMessage response)
{
if (response.IsSuccessStatusCode
|| response.StatusCode == HttpStatusCode.BadGateway
if (response.StatusCode == HttpStatusCode.BadGateway
|| response.StatusCode == HttpStatusCode.GatewayTimeout
|| response.StatusCode == HttpStatusCode.ServiceUnavailable
|| response.StatusCode == HttpStatusCode.RequestTimeout
Expand Down
12 changes: 7 additions & 5 deletions src/NuGetGallery/Helpers/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

using System;
using System.Globalization;
using System.Web;
using System.Web.Mvc;

namespace NuGetGallery.Helpers
{
Expand Down Expand Up @@ -41,17 +43,17 @@ public static string Abbreviate(this string text, int length)
return text.Substring(0, length - 3) + "...";
}

public static string TruncateAtWordBoundary(this string input, int length = 300, string ommission = "...", string morText = "")
public static MvcHtmlString TruncateAtWordBoundary(this string input, int length = 300, string ommission = "...", string moreText = "")
{
if (string.IsNullOrEmpty(input) || input.Length < length)
return input;
return new MvcHtmlString(input);

int nextSpace = input.LastIndexOf(" ", length, StringComparison.Ordinal);

return string.Format(CultureInfo.CurrentCulture, "{2}{1}{0}",
morText,
return new MvcHtmlString(string.Format(CultureInfo.CurrentCulture, "{2}{1}{0}",
moreText,
ommission,
input.Substring(0, (nextSpace > 0) ? nextSpace : length).Trim());
HttpUtility.HtmlEncode(input.Substring(0, (nextSpace > 0) ? nextSpace : length).Trim())));
}
}
}
2 changes: 1 addition & 1 deletion src/NuGetGallery/Views/Shared/_ListPackage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</span>
</p>
<p>
@Html.Raw(Model.Description.TruncateAtWordBoundary(350, "<text>... </text>", string.Format(System.Globalization.CultureInfo.CurrentCulture, "<a href=\"{0}\">More information</a>", @Url.Package(Model))))
@Model.Description.TruncateAtWordBoundary(350, "...", string.Format(System.Globalization.CultureInfo.CurrentCulture, " <a href=\"{0}\">More information</a>", @Url.Package(Model)))
</p>

@if (!String.IsNullOrEmpty(Model.MinClientVersion))
Expand Down

0 comments on commit e01abfa

Please sign in to comment.