diff --git a/cmd/version.go b/cmd/version.go index cdad51e..d32de62 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -5,7 +5,7 @@ import ( "runtime" ) -const version = "v0.1.4" +const version = "v0.1.6" func getVersion() string { return fmt.Sprintf("%s %s/%s", version, runtime.GOOS, runtime.GOARCH) diff --git a/s3/upload.go b/s3/upload.go index 21f74af..9c511fd 100644 --- a/s3/upload.go +++ b/s3/upload.go @@ -29,6 +29,7 @@ import ( "net/url" "os" "path/filepath" + "strings" htmltemp "html/template" @@ -54,7 +55,6 @@ func UploadFile(upload Upload) (string, error) { } defer f.Close() - // Set the content-type so that the file like index.html can be viewed directly from the browser fileInfo, _ := f.Stat() var size int64 = fileInfo.Size() buffer := make([]byte, size) @@ -63,6 +63,10 @@ func UploadFile(upload Upload) (string, error) { return "", err } contentType := http.DetectContentType(buffer) + // Set the content-type so that the file like index.html can be viewed directly from the browser + if strings.Contains(upload.SrcFile, "html") { + contentType = "text/html" + } // Create a new session sess := session.Must(session.NewSession())