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
+3 -2
View File
@@ -3,6 +3,7 @@ package handlers
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"os"
"path/filepath" "path/filepath"
"github.com/bchapuis/restic-server/config" "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) http.Error(w, "403 invalid ID", 403)
return return
} }
file := filepath.Join(config.DataPath(repo), id) file := filepath.Join(config.DataPath(repo), id.String())
if _, err := os.Stat(file); err != nil { if _, err := os.Stat(file); err != nil {
http.Error(w, "404 repository not found", 404) http.Error(w, "404 repository not found", 404)
return return
@@ -37,7 +38,7 @@ func GetData(w http.ResponseWriter, r *http.Request) {
http.Error(w, "403 invalid ID", 403) http.Error(w, "403 invalid ID", 403)
return return
} }
file := filepath.Join(config.DataPath(repo), id) file := filepath.Join(config.DataPath(repo), id.String())
if _, err := os.Stat(file); err != nil { if _, err := os.Stat(file); err != nil {
http.Error(w, "404 repository not found", 404) http.Error(w, "404 repository not found", 404)
return return
-1
View File
@@ -1,7 +1,6 @@
package handlers package handlers
import ( import (
"fmt"
"log" "log"
"net/http" "net/http"
) )
+1
View File
@@ -58,6 +58,7 @@ func (router Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} }
func main() { func main() {
path, _ := ioutil.TempDir("", "restic-repository-") path, _ := ioutil.TempDir("", "restic-repository-")
config.Init(path) config.Init(path)