mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
[PR #411] [MERGED] Improved relative path checking based on file existence #902
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/wiremock/WireMock.Net/pull/411
Author: @NoahLerner
Created: 1/30/2020
Status: ✅ Merged
Merged: 2/2/2020
Merged by: @StefH
Base:
master← Head:Improved_RelativePath_BodyAsFile📝 Commits (10+)
c1f757bImproved relative path checking based on file existence962824fApply File.Exists logic to ReadResponseBodyAsString as well9bc737fMake path handling more robust since path is user definede8a8314Unit tests for relative path feature66448a9Replace all back and forward slashes with system dependent DirectorySeparatorChar3681e64Attempt fix broken directory separator chars for Unix platforms88f48acRevert wrapping GetMappingFolder with CleanPath11f36fcMove CleanPath logic to its own class3061226Remove whitespace01b9c5dRemove more whitespace📊 Changes
6 files changed (+155 additions, -13 deletions)
View changed files
📝
src/WireMock.Net/Handlers/LocalFileSystemHandler.cs(+6 -5)➕
src/WireMock.Net/Util/PathUtils.cs(+36 -0)📝
test/WireMock.Net.Tests/ResponseBuilders/ResponseWithBodyFromFileTests.cs(+63 -8)➕
test/WireMock.Net.Tests/Util/PathUtilsTests.cs(+44 -0)📝
test/WireMock.Net.Tests/WireMock.Net.Tests.csproj(+3 -0)➕
test/WireMock.Net.Tests/__admin/mappings/subdirectory/MyXmlResponse.xml(+3 -0)📄 Description
If the file exists at the relative path, then use it. If not, then use the path as is.
This is stronger than the previous check if the path is just the filename, since if it's just a file name then we'll check if the file exists at the relative path & then use if yes. Otherwise, use the path as is.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.