Skip to content

Commit

Permalink
Hotfix for bad url characters in folder paths
Browse files Browse the repository at this point in the history
  • Loading branch information
napernik committed Jan 18, 2012
1 parent 3e82789 commit 52eb1d3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Composite/Core/WebClient/MediaUrlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public static class MediaUrlHelper
private static readonly string DecodedFullInternalMediaUrlPrefix = InternalMediaUrlPrefix + "(";
private static readonly string RawMediaUrlPrefix = "~/media";

private static readonly string ForbiddenUrlCharacters = @"<>*%&\?";


/// <exclude />
public static string GetUrl(IMediaFile file)
{
Expand Down Expand Up @@ -276,6 +279,12 @@ public static string ChangeInternalMediaUrlsToPublic(string content)

string pathToFile = UrlUtils.Combine(file.FolderPath, file.FileName);

// Hotfix for characters not accepted by ASP.NET by default
foreach (var ch in ForbiddenUrlCharacters)
{
pathToFile = pathToFile.Replace(ch, 'x');
}

// IIS6 doesn't have wildcard mapping by default, so removing image extension if running in "classic" app pool
if(!HttpRuntime.UsingIntegratedPipeline)
{
Expand Down

0 comments on commit 52eb1d3

Please sign in to comment.