fixed imports

This commit is contained in:
Chapuis Bertil
2015-08-11 14:52:42 +02:00
parent 7d2f88ada0
commit 90266e7006
3 changed files with 4 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ package handlers
import (
"fmt"
"net/http"
"os"
"path/filepath"
"github.com/bchapuis/restic-server/config"
@@ -19,7 +20,7 @@ func HeadData(w http.ResponseWriter, r *http.Request) {
http.Error(w, "403 invalid ID", 403)
return
}
file := filepath.Join(config.DataPath(repo), id)
file := filepath.Join(config.DataPath(repo), id.String())
if _, err := os.Stat(file); err != nil {
http.Error(w, "404 repository not found", 404)
return
@@ -37,7 +38,7 @@ func GetData(w http.ResponseWriter, r *http.Request) {
http.Error(w, "403 invalid ID", 403)
return
}
file := filepath.Join(config.DataPath(repo), id)
file := filepath.Join(config.DataPath(repo), id.String())
if _, err := os.Stat(file); err != nil {
http.Error(w, "404 repository not found", 404)
return

View File

@@ -1,7 +1,6 @@
package handlers
import (
"fmt"
"log"
"net/http"
)

View File

@@ -58,6 +58,7 @@ func (router Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
func main() {
path, _ := ioutil.TempDir("", "restic-repository-")
config.Init(path)