Print file names when curling /files/ path.
This commit is contained in:
parent
821c0c91c8
commit
9d9acbe7d3
17
main.go
17
main.go
@ -122,6 +122,23 @@ func Files(c echo.Context) error {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UserAgent := c.Request().UserAgent()
|
||||||
|
|
||||||
|
log.Print(UserAgent)
|
||||||
|
|
||||||
|
match, err := regexp.MatchString("^curl/.*", UserAgent)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if match {
|
||||||
|
out := ""
|
||||||
|
for _, f := range filelist {
|
||||||
|
out += f.Name() + "\n"
|
||||||
|
}
|
||||||
|
return c.String(http.StatusOK, out)
|
||||||
|
}
|
||||||
|
|
||||||
var Type string
|
var Type string
|
||||||
var Content string
|
var Content string
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user