forked from crony/UpFast
Fix regex detection.
This commit is contained in:
parent
2c1342a20e
commit
8c1ab0b53b
10
main.go
10
main.go
@ -185,8 +185,16 @@ func Upload(c echo.Context) error {
|
||||
|
||||
UserAgent := c.Request().UserAgent()
|
||||
|
||||
if regexp.MatchString("^curl/.*", UserAgent); err != nil {
|
||||
log.Print(UserAgent)
|
||||
|
||||
match, err := regexp.MatchString("^curl/.*", UserAgent)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if match {
|
||||
return c.String(http.StatusOK, fileUrl)
|
||||
}
|
||||
|
||||
return c.Redirect(http.StatusMovedPermanently, "/files/"+file.Filename)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user