mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-11-27 06:30:19 +01:00
Fix path (#416)
* chan is leaked * Remove path.Clean Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
This commit is contained in:
parent
6ab75b30e5
commit
e5455d9713
2 changed files with 5 additions and 4 deletions
|
@ -57,6 +57,7 @@ func (s *Server) scanHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
c := clamd.NewClamd(s.ClamAVDaemonHost)
|
c := clamd.NewClamd(s.ClamAVDaemonHost)
|
||||||
|
|
||||||
abort := make(chan bool)
|
abort := make(chan bool)
|
||||||
|
defer close(abort)
|
||||||
response, err := c.ScanStream(reader, abort)
|
response, err := c.ScanStream(reader, abort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Printf("%s", err.Error())
|
s.logger.Printf("%s", err.Error())
|
||||||
|
@ -70,6 +71,4 @@ func (s *Server) scanHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
case <-time.After(time.Second * 60):
|
case <-time.After(time.Second * 60):
|
||||||
abort <- true
|
abort <- true
|
||||||
}
|
}
|
||||||
|
|
||||||
close(abort)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
blackfriday "github.com/russross/blackfriday/v2"
|
|
||||||
"html"
|
"html"
|
||||||
html_template "html/template"
|
html_template "html/template"
|
||||||
"io"
|
"io"
|
||||||
|
@ -54,9 +53,12 @@ import (
|
||||||
text_template "text/template"
|
text_template "text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
blackfriday "github.com/russross/blackfriday/v2"
|
||||||
|
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
|
||||||
web "github.com/dutchcoders/transfer.sh-web"
|
web "github.com/dutchcoders/transfer.sh-web"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/microcosm-cc/bluemonday"
|
"github.com/microcosm-cc/bluemonday"
|
||||||
|
@ -286,7 +288,7 @@ func (s *Server) notFoundHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func sanitize(fileName string) string {
|
func sanitize(fileName string) string {
|
||||||
return path.Clean(path.Base(fileName))
|
return path.Base(fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) postHandler(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) postHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in a new issue