filestore: keep ID passed to NewUpload, if available (#820)
* fix(filestore): keep info.ID * fix
This commit is contained in:
parent
f0b63f4371
commit
306a031953
|
@ -49,9 +49,10 @@ func (store FileStore) UseIn(composer *handler.StoreComposer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (store FileStore) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error) {
|
func (store FileStore) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error) {
|
||||||
id := uid.Uid()
|
if info.ID == "" {
|
||||||
binPath := store.binPath(id)
|
info.ID = uid.Uid()
|
||||||
info.ID = id
|
}
|
||||||
|
binPath := store.binPath(info.ID)
|
||||||
info.Storage = map[string]string{
|
info.Storage = map[string]string{
|
||||||
"Type": "filestore",
|
"Type": "filestore",
|
||||||
"Path": binPath,
|
"Path": binPath,
|
||||||
|
@ -72,8 +73,8 @@ func (store FileStore) NewUpload(ctx context.Context, info handler.FileInfo) (ha
|
||||||
|
|
||||||
upload := &fileUpload{
|
upload := &fileUpload{
|
||||||
info: info,
|
info: info,
|
||||||
infoPath: store.infoPath(id),
|
infoPath: store.infoPath(info.ID),
|
||||||
binPath: store.binPath(id),
|
binPath: binPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeInfo creates the file by itself if necessary
|
// writeInfo creates the file by itself if necessary
|
||||||
|
|
Loading…
Reference in New Issue