refactor: change to use hash metadata key
This commit is contained in:
parent
b77bebe3b1
commit
b104af5e4c
|
@ -23,7 +23,7 @@ import (
|
||||||
|
|
||||||
const TUS_API_PATH = "/files/tus"
|
const TUS_API_PATH = "/files/tus"
|
||||||
|
|
||||||
const HASH_META_HEADER = "blake3-hash"
|
const HASH_META_HEADER = "hash"
|
||||||
|
|
||||||
func Init() *tusd.Handler {
|
func Init() *tusd.Handler {
|
||||||
store := &tusstore.DbFileStore{
|
store := &tusstore.DbFileStore{
|
||||||
|
@ -46,7 +46,7 @@ func Init() *tusd.Handler {
|
||||||
hash := hook.Upload.MetaData[HASH_META_HEADER]
|
hash := hook.Upload.MetaData[HASH_META_HEADER]
|
||||||
|
|
||||||
if len(hash) == 0 {
|
if len(hash) == 0 {
|
||||||
msg := "missing blake3-hash metadata"
|
msg := "missing hash metadata"
|
||||||
logger.Get().Debug(msg)
|
logger.Get().Debug(msg)
|
||||||
return errors.New(msg)
|
return errors.New(msg)
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ func (store DbFileStore) NewUpload(ctx context.Context, info handler.FileInfo) (
|
||||||
upload := &fileUpload{
|
upload := &fileUpload{
|
||||||
info: info,
|
info: info,
|
||||||
binPath: binPath,
|
binPath: binPath,
|
||||||
hash: info.MetaData["blake3-hash"],
|
hash: info.MetaData["hash"],
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeInfo creates the file by itself if necessary
|
// writeInfo creates the file by itself if necessary
|
||||||
|
|
Loading…
Reference in New Issue