1
0
forked from crony/UpFast

Fix regex detection.

This commit is contained in:
CronyAkatsuki 2023-12-21 12:23:11 +01:00
parent 2c1342a20e
commit 8c1ab0b53b

10
main.go
View File

@ -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)
}