diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9414382 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Dockerfile diff --git a/Dockerfile b/Dockerfile index cfc9157..c56bf66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,5 +15,5 @@ COPY . /go/src/pastebin RUN go get -v -d RUN go get github.com/GeertJohan/go.rice/rice -RUN rice embed-go +RUN GOROOT=/go rice embed-go RUN go install -v diff --git a/server.go b/server.go index 173ce27..3b3b1eb 100644 --- a/server.go +++ b/server.go @@ -8,6 +8,7 @@ import ( "log" "net/http" "net/url" + "strconv" "strings" "time" @@ -19,7 +20,7 @@ import ( "github.com/rcrowley/go-metrics/exp" "github.com/thoas/stats" - "github.com/GeertJohan/go.rice" + rice "github.com/GeertJohan/go.rice" "github.com/julienschmidt/httprouter" "github.com/patrickmn/go-cache" "github.com/renstrom/shortuuid" @@ -160,7 +161,7 @@ func (s *Server) DownloadHandler() httprouter.Handle { w.Header().Set("Content-Disposition", "attachment; filename="+uuid) w.Header().Set("Content-Type", "application/octet-stream") - w.Header().Set("Content-Length", string(content.Size())) + w.Header().Set("Content-Length", strconv.FormatInt(content.Size(), 10)) http.ServeContent(w, r, uuid, time.Now(), content) }