Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for incorrectly decoded paths with accents #1

Merged
merged 1 commit into from Oct 31, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,3 +1,5 @@
test/

# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/
Expand Down
1 change: 1 addition & 0 deletions source/CachedImage.csproj
Expand Up @@ -35,6 +35,7 @@
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
Expand Down
7 changes: 5 additions & 2 deletions source/FileCache.cs
@@ -1,6 +1,8 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Security.Policy;
using System.Web;

namespace CachedImage
{
Expand Down Expand Up @@ -30,8 +32,9 @@ public static string FromUrl(string url)

// Cast the string into a Uri so we can access the image name without regex
var uri = new Uri(url);
string localFile = string.Format("{0}\\{1}", AppCacheDirectory, uri.Segments[uri.Segments.Length - 1]);

var segment = uri.Segments[uri.Segments.Length - 1];
var urlDecode = HttpUtility.UrlDecode(segment);
string localFile = string.Format("{0}\\{1}", AppCacheDirectory, urlDecode);
if (!File.Exists(localFile))
{
HttpHelper.GetAndSaveToFile(url, localFile);
Expand Down