diff --git a/pkg/filestore/filestore.go b/pkg/filestore/filestore.go index fe0ad1f..89a7d46 100644 --- a/pkg/filestore/filestore.go +++ b/pkg/filestore/filestore.go @@ -3,7 +3,7 @@ // FileStore is a storage backend used as a handler.DataStore in handler.NewHandler. // It stores the uploads in a directory specified in two different files: The // `[id].info` files are used to store the fileinfo in JSON format. The -// `[id].bin` files contain the raw binary data uploaded. +// `[id]` files without an extension contain the raw binary data uploaded. // No cleanup is performed so you may want to run a cronjob to ensure your disk // is not filled up with old and finished uploads. // @@ -67,7 +67,7 @@ func (store FileStore) NewUpload(info handler.FileInfo) (id string, err error) { "Path": binPath, } - // Create .bin file with no content + // Create binary file with no content file, err := os.OpenFile(binPath, os.O_CREATE|os.O_WRONLY, defaultFilePerm) if err != nil { if os.IsNotExist(err) { @@ -213,9 +213,9 @@ func (store FileStore) newLock(id string) (lockfile.Lockfile, error) { return lockfile.Lockfile(path), nil } -// binPath returns the path to the .bin storing the binary data. +// binPath returns the path to the file storing the binary data. func (store FileStore) binPath(id string) string { - return filepath.Join(store.Path, id+".bin") + return filepath.Join(store.Path, id) } // infoPath returns the path to the .info file storing the file's info. diff --git a/pkg/filestore/filestore_test.go b/pkg/filestore/filestore_test.go index e886c1c..fbf0fb0 100644 --- a/pkg/filestore/filestore_test.go +++ b/pkg/filestore/filestore_test.go @@ -47,7 +47,7 @@ func TestFilestore(t *testing.T) { a.Equal(handler.MetaData{"hello": "world"}, info.MetaData) a.Equal(2, len(info.Storage)) a.Equal("filestore", info.Storage["Type"]) - a.Equal(filepath.Join(tmp, id+".bin"), info.Storage["Path"]) + a.Equal(filepath.Join(tmp, id), info.Storage["Path"]) // Write data to upload bytesWritten, err := store.WriteChunk(id, 0, strings.NewReader("hello world"))