mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 10:41:03 +01:00
minor
Former-commit-id: f201fcad8fb425d0a5e9c32faa649b5199f60183
This commit is contained in:
parent
16a6372cc9
commit
0b279c11fe
|
@ -395,6 +395,10 @@ func (api *APIBuilder) HandleMany(methodOrMulti string, relativePathorMulti stri
|
||||||
// Examples can be found at: https://github.com/kataras/iris/tree/master/_examples/file-server
|
// Examples can be found at: https://github.com/kataras/iris/tree/master/_examples/file-server
|
||||||
func (api *APIBuilder) HandleDir(requestPath, directory string, opts ...DirOptions) (routes []*Route) {
|
func (api *APIBuilder) HandleDir(requestPath, directory string, opts ...DirOptions) (routes []*Route) {
|
||||||
options := getDirOptions(opts...)
|
options := getDirOptions(opts...)
|
||||||
|
// TODO(@kataras): Add option(s) to enable file & directory deletion (DELETE wildcard route)
|
||||||
|
// and integrade it with the new `DirListRich` helper
|
||||||
|
// (either context menu override on right-click of the file name or to a new table column)
|
||||||
|
// Note that, an auth middleware can be already registered, so no need to add options for that here.
|
||||||
h := FileServer(directory, options)
|
h := FileServer(directory, options)
|
||||||
description := directory
|
description := directory
|
||||||
fileName, lineNumber := context.HandlerFileLine(h) // take those before StripPrefix.
|
fileName, lineNumber := context.HandlerFileLine(h) // take those before StripPrefix.
|
||||||
|
|
|
@ -395,7 +395,6 @@ func FileServer(directory string, opts ...DirOptions) context.Handler {
|
||||||
ctx.SetLastModified(info.ModTime())
|
ctx.SetLastModified(info.ModTime())
|
||||||
err = dirList(ctx, info.Name(), f)
|
err = dirList(ctx, info.Name(), f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
println(err.Error())
|
|
||||||
plainStatusCode(ctx, http.StatusInternalServerError)
|
plainStatusCode(ctx, http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user