Skip to content
Snippets Groups Projects
Commit a5f13756 authored by Travis Ralston's avatar Travis Ralston
Browse files

Strip obvious paths from uploaded file names

parent e149f2e8
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"path/filepath"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/turt2live/matrix-media-repo/api" "github.com/turt2live/matrix-media-repo/api"
...@@ -16,7 +17,7 @@ type MediaUploadedResponse struct { ...@@ -16,7 +17,7 @@ type MediaUploadedResponse struct {
} }
func UploadMedia(r *http.Request, log *logrus.Entry, user api.UserInfo) interface{} { func UploadMedia(r *http.Request, log *logrus.Entry, user api.UserInfo) interface{} {
filename := r.URL.Query().Get("filename") filename := filepath.Base(r.URL.Query().Get("filename"))
defer r.Body.Close() defer r.Body.Close()
log = log.WithFields(logrus.Fields{ log = log.WithFields(logrus.Fields{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment