1
0
Fork 0
mirror of https://github.com/vbatts/imgsrv.git synced 2024-12-24 23:06:31 +00:00

fixing the regex find for extensions

This commit is contained in:
Vincent Batts 2013-09-20 17:21:26 -04:00
parent d4824ad6a2
commit 6e439b0de4

View file

@ -569,9 +569,9 @@ func routeExt(w http.ResponseWriter, r *http.Request) {
}
ext := strings.ToLower(uriChunks[1])
ext_pat := fmt.Sprintf("/%s$/", ext)
ext_pat := fmt.Sprintf("%s$", ext)
files := []types.File{}
err := gfs.Find(bson.M{"filename": ext_pat}).Sort("-metadata.timestamp").All(&files)
err := gfs.Find(bson.M{"filename": bson.M{ "$regex": ext_pat, "$options": "i"}}).Sort("-metadata.timestamp").All(&files)
if err != nil {
serverErr(w, r, err)
return