summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJulian Hurst <julian.hurst@digdash.com>2025-01-23 16:09:39 +0100
committerJulian Hurst <julian.hurst@digdash.com>2025-01-23 16:09:39 +0100
commit6ababe78852e5e2398fe5cb125cba7a0c9e6b44e (patch)
tree8a9cb59f54c13ad0000181e1cb365d025b4fa58a /main.go
parent634a9911e6828a20ed898aabce1f6302ebcf2f54 (diff)
downloadbox-6ababe78852e5e2398fe5cb125cba7a0c9e6b44e.tar.gz
Add metadata support for specifying the extension
Diffstat (limited to 'main.go')
-rw-r--r--main.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.go b/main.go
index ce9a0ab..68037e8 100644
--- a/main.go
+++ b/main.go
@@ -86,6 +86,7 @@ func (handler BoxHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusUnauthorized)
return
}
+ ext := r.Header.Get("X-ResourceMeta-Extension")
u, err := uuid.NewRandom()
if err != nil {
log.Println(err)
@@ -93,7 +94,7 @@ func (handler BoxHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
return
}
- filename := filepath.Join(handler.filesPath, u.String())
+ filename := filepath.Join(handler.filesPath, u.String()) + ext
log.Printf("Boxing %s...\n", filename)
f, err := os.Create(filename)
if err != nil {