Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Use IHostingEnvironment.WebRoot as the default static files root. #9

Merged
merged 1 commit into from
Sep 12, 2014

Conversation

Tratcher
Copy link
Member

#8

Use NotNull.
Use DI to create the middleware (and inject IHostingEnvironment).


internal static string ResolveRootPath(string webRoot, PathString path)
{
return Path.GetFullPath(Path.Combine(webRoot, "." + path.Value));
Copy link
Member

Choose a reason for hiding this comment

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

What's the . for?

@Tratcher
Copy link
Member Author

Updated.


internal static string ResolveRootPath(string webRoot, PathString path)
{
return Path.GetFullPath(Path.Combine(webRoot, path.Value ?? string.Empty));
Copy link
Member

Choose a reason for hiding this comment

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

Won't the request path have slashes going the wrong way? Does Path.Combine fix that?

Copy link
Member Author

Choose a reason for hiding this comment

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

GetFullPath fixes that.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, we should verify this on mono as well. /cc @Praburaj

@davidfowl
Copy link
Member

:shipit:

@Tratcher Tratcher merged commit ea3ea90 into dev Sep 12, 2014
@Tratcher Tratcher deleted the webroot branch September 12, 2014 17:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants