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

Url decode path before fetching from file system, fixes #278 #279

Merged
merged 4 commits into from
Jul 2, 2022

Conversation

jrunestone
Copy link
Contributor

@jrunestone jrunestone commented Jul 1, 2022

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

The base class FileProviderImageProvider checks if the unmodified request path exists in the file provider, however this returns false if the path is url encoded (as in the case of special characters in the path, eg á or ö). Simply url decoding the path before checking seems to solve this issue.

Seems reasonable enough? Maybe a test case would be in order.

@CLAassistant
Copy link

CLAassistant commented Jul 1, 2022

CLA assistant check
All committers have signed the CLA.

Co-authored-by: Ronald Barendse <ronald@barend.se>
@codecov
Copy link

codecov bot commented Jul 2, 2022

Codecov Report

Merging #279 (92a3b3b) into main (20fbfae) will decrease coverage by 0%.
The diff coverage is 52%.

@@         Coverage Diff         @@
##           main   #279   +/-   ##
===================================
- Coverage    85%    85%   -1%     
===================================
  Files        75     75           
  Lines      2029   2041   +12     
  Branches    296    298    +2     
===================================
+ Hits       1737   1741    +4     
- Misses      209    215    +6     
- Partials     83     85    +2     
Flag Coverage Δ
unittests 85% <52%> (-1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/ImageSharp.Web/CaseHandlingUriBuilder.cs 65% <50%> (-12%) ⬇️
...geSharp.Web/Providers/FileProviderImageProvider.cs 78% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20fbfae...92a3b3b. Read the comment docs.

@JimBobSquarePants
Copy link
Member

@jrunestone I've jut pushed a change to your PR that changes the name of the test image to use diacritics.

I'll need to make some changes to the tests to ensure the generated token is now correct so please don't make any changes while I work on this.

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks! 👍

@JimBobSquarePants JimBobSquarePants merged commit 5e5fab7 into SixLabors:main Jul 2, 2022
@jrunestone
Copy link
Contributor Author

YW, can we get a new release soon? :)

@jrunestone jrunestone deleted the 278-special-characters branch July 2, 2022 15:51
@JimBobSquarePants
Copy link
Member

There's a new release on NuGet now 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants