Browse Source

v4.1.2

IImageService now correctly checks if request is valid


Former-commit-id: 071b8699c0cbeb17710364fc237eba790522649f
Former-commit-id: 6f7a05e3bc703eb4ebb0dcc9195bb0e87c02a592
af/merge-core
James South 11 years ago
parent
commit
cdb171237f
  1. 2
      build/NuSpecs/ImageProcessor.Web.nuspec
  2. 2
      build/build.xml
  3. 28
      src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs
  4. 4
      src/ImageProcessor.Web/Properties/AssemblyInfo.cs
  5. 3
      src/TestWebsites/MVC/TestImageService.cs

2
build/NuSpecs/ImageProcessor.Web.nuspec

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata> <metadata>
<id>ImageProcessor.Web</id> <id>ImageProcessor.Web</id>
<version>4.1.1.0</version> <version>4.1.2.0</version>
<title>ImageProcessor.Web</title> <title>ImageProcessor.Web</title>
<authors>James South</authors> <authors>James South</authors>
<owners>James South</owners> <owners>James South</owners>

2
build/build.xml

@ -13,7 +13,7 @@
<project> <project>
<name>ImageProcessor Web</name> <name>ImageProcessor Web</name>
<version>4.1.1.0</version> <version>4.1.2.0</version>
<folder>..\src\ImageProcessor.Web</folder> <folder>..\src\ImageProcessor.Web</folder>
<projfile>ImageProcessor.Web.csproj</projfile> <projfile>ImageProcessor.Web.csproj</projfile>
<outputs> <outputs>

28
src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs

@ -328,9 +328,21 @@ namespace ImageProcessor.Web.HttpModules
string parts = !string.IsNullOrWhiteSpace(urlParameters) ? "?" + urlParameters : string.Empty; string parts = !string.IsNullOrWhiteSpace(urlParameters) ? "?" + urlParameters : string.Empty;
string fullPath = string.Format("{0}{1}?{2}", requestPath, parts, queryString); string fullPath = string.Format("{0}{1}?{2}", requestPath, parts, queryString);
object resourcePath;
if (hasMultiParams)
{
resourcePath = string.IsNullOrWhiteSpace(urlParameters)
? new Uri(requestPath, UriKind.RelativeOrAbsolute)
: new Uri(requestPath + "?" + urlParameters, UriKind.RelativeOrAbsolute);
}
else
{
resourcePath = requestPath;
}
// Check whether the path is valid for other requests. // Check whether the path is valid for other requests.
if (!isFileLocal && !currentService.IsValidRequest(requestPath + "?" + urlParameters)) if (resourcePath == null || !currentService.IsValidRequest(resourcePath.ToString()))
{ {
return; return;
} }
@ -375,19 +387,7 @@ namespace ImageProcessor.Web.HttpModules
{ {
using (await this.locker.LockAsync(cachedPath)) using (await this.locker.LockAsync(cachedPath))
{ {
byte[] imageBuffer; byte[] imageBuffer = await currentService.GetImage(resourcePath);
if (hasMultiParams)
{
Uri uri = string.IsNullOrWhiteSpace(urlParameters)
? new Uri(requestPath, UriKind.RelativeOrAbsolute)
: new Uri(requestPath + "?" + urlParameters, UriKind.RelativeOrAbsolute);
imageBuffer = await currentService.GetImage(uri);
}
else
{
imageBuffer = await currentService.GetImage(requestPath);
}
using (MemoryStream memoryStream = new MemoryStream(imageBuffer)) using (MemoryStream memoryStream = new MemoryStream(imageBuffer))
{ {

4
src/ImageProcessor.Web/Properties/AssemblyInfo.cs

@ -40,5 +40,5 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("4.1.1.0")] [assembly: AssemblyVersion("4.1.2.0")]
[assembly: AssemblyFileVersion("4.1.1.0")] [assembly: AssemblyFileVersion("4.1.2.0")]

3
src/TestWebsites/MVC/TestImageService.cs

@ -17,6 +17,7 @@ namespace Test_Website_NET45
using System.Web; using System.Web;
using System.Web.Hosting; using System.Web.Hosting;
using ImageProcessor.Web.Helpers;
using ImageProcessor.Web.Services; using ImageProcessor.Web.Services;
/// <summary> /// <summary>
@ -81,7 +82,7 @@ namespace Test_Website_NET45
/// </returns> /// </returns>
public bool IsValidRequest(string path) public bool IsValidRequest(string path)
{ {
return true; return ImageHelpers.IsValidImageExtension(path.Split(new[] { '&', '?' })[0]);
} }
/// <summary> /// <summary>

Loading…
Cancel
Save