Don't prepend temp, use subdir

This commit is contained in:
Tyler 2017-09-14 00:11:44 -04:00
parent 2325074547
commit 7d59377309
2 changed files with 13 additions and 2 deletions

View File

@ -97,6 +97,17 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
modifiedArches := make(map[string]bool) modifiedArches := make(map[string]bool)
baseDir := path.Join(os.TempDir(), "deb-simple")
if _, err := os.Stat(baseDir); err != nil {
if os.IsNotExist(err) {
if err := os.MkdirAll(baseDir, 0755); err != nil {
httpErrorf(w, "error creating path: %s", err)
return
}
}
}
for { for {
part, err := reader.NextPart() part, err := reader.NextPart()
@ -108,7 +119,7 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
continue continue
} }
tempFile := path.Join(os.TempDir(), "temp_" + part.FileName()) tempFile := path.Join(baseDir, part.FileName())
dst, err := os.Create(tempFile) dst, err := os.Create(tempFile)

View File

@ -15,7 +15,7 @@ import (
"github.com/go-ini/ini" "github.com/go-ini/ini"
) )
var VERSION string = "1.3.2" var VERSION string = "1.3.3"
func packageName(name string) string { func packageName(name string) string {
if index := strings.Index(name, "_"); index != -1 { if index := strings.Index(name, "_"); index != -1 {