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

StaticFiles throws in _fileProvider.GetFileInfo on /.%20./  #204

@Tratcher

Description

@Tratcher

From @cweb on June 9, 2016 22:57

Sending a request of GET /bar/.%20./foo.txt HTTP/1.1 or GET /bar/%20./foo.txt HTTP/1.1

Throws an unhandled ArgumentException at:

        public bool LookupFileInfo()
        {
            _fileInfo = _fileProvider.GetFileInfo(_subPath.Value);  <<<<<<<<<<<<<<<<< unhandled exception here
An exception of type 'System.ArgumentException' occurred in mscorlib.dll but was not handled in user code

Additional information: The path is not of a legal form.

   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider.GetFullPath(String path)
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider.GetFileInfo(String subpath)
   at Microsoft.AspNetCore.StaticFiles.StaticFileContext.LookupFileInfo() in C:\Users\casaba\Documents\StaticFiles\src\Microsoft.AspNetCore.StaticFiles\StaticFileContext.cs:line 141
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) in C:\Users\casaba\Documents\StaticFiles\src\Microsoft.AspNetCore.StaticFiles\StaticFileMiddleware.cs:line 86
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext()

Copied from original issue: aspnet/StaticFiles#137

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions