From fe9bf93c2d1d65590695e9739ab30a030a66c3b6 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Sat, 2 Apr 2016 07:59:23 +0200
Subject: better name for upload dir


diff --git a/src/rhimportd/uploadWeb.go b/src/rhimportd/uploadWeb.go
index e0326ad..978f6cb 100644
--- a/src/rhimportd/uploadWeb.go
+++ b/src/rhimportd/uploadWeb.go
@@ -63,7 +63,7 @@ const (
 
 func webUploadHandler(conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport.SessionStoreChan, trusted bool, w http.ResponseWriter, r *http.Request) {
 	if r.Method == "GET" {
-		http.ServeFile(w, r, "./html/upload-form.html")
+		http.ServeFile(w, r, "./html/upload-form.html") // TODO: hardcoded html-dir... should we print the html directly?
 		return
 	}
 
@@ -117,7 +117,8 @@ func webUploadHandler(conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport
 
 	rhl.Printf("WebUploadHandler: got request from user '%s', filename='%s'", username, hdr.Filename)
 
-	dstpath, err := ioutil.TempDir(conf.TempDir, "rhimportd-")
+	// TODO: uploaded files should be deleted after some time... create directory with timestamp as part of the name?
+	dstpath, err := ioutil.TempDir(conf.TempDir, "webupload-"+username+"-")
 	if err != nil {
 		rhl.Printf("WebUploadHandler: error creating temporary directory: %v", err)
 		webUploadErrorResponse(w, http.StatusInternalServerError, err.Error())
-- 
cgit v0.10.2