@@ -132,6 +132,9 @@ func (fs *Decomposedfs) InitiateUpload(ctx context.Context, ref *provider.Refere
132
132
"dir" : filepath .Dir (relative ),
133
133
},
134
134
Size : uploadLength ,
135
+ Storage : map [string ]string {
136
+ "SpaceRoot" : n .SpaceRoot .ID ,
137
+ },
135
138
}
136
139
137
140
if metadata != nil {
@@ -250,16 +253,23 @@ func (fs *Decomposedfs) NewUpload(ctx context.Context, info tusd.FileInfo) (uplo
250
253
if err != nil {
251
254
return nil , errors .Wrap (err , "Decomposedfs: error determining owner" )
252
255
}
256
+ var spaceRoot string
257
+ if info .Storage != nil {
258
+ if spaceRoot , ok = info .Storage ["SpaceRoot" ]; ! ok {
259
+ spaceRoot = n .SpaceRoot .ID
260
+ }
261
+ } else {
262
+ spaceRoot = n .SpaceRoot .ID
263
+ }
253
264
254
265
info .Storage = map [string ]string {
255
- // Todo: add storage space root
256
266
"Type" : "OCISStore" ,
257
267
"BinPath" : binPath ,
258
268
259
269
"NodeId" : n .ID ,
260
270
"NodeParentId" : n .ParentID ,
261
271
"NodeName" : n .Name ,
262
- "SpaceRoot" : n . SpaceRoot . ID ,
272
+ "SpaceRoot" : spaceRoot ,
263
273
264
274
"Idp" : usr .Id .Idp ,
265
275
"UserId" : usr .Id .OpaqueId ,
@@ -739,14 +749,13 @@ func (upload *fileUpload) ConcatUploads(ctx context.Context, uploads []tusd.Uplo
739
749
}
740
750
741
751
func checkQuota (ctx context.Context , fs * Decomposedfs , spaceRoot * node.Node , fileSize uint64 ) (quotaSufficient bool , err error ) {
742
- req := & provider.GetQuotaRequest {
752
+ total , inUse , err := fs . GetQuota ( ctx , & provider.GetQuotaRequest {
743
753
Ref : & provider.Reference {
744
754
ResourceId : & provider.ResourceId {
745
755
OpaqueId : spaceRoot .ID ,
746
756
},
747
757
},
748
- }
749
- total , inUse , err := fs .GetQuota (ctx , req )
758
+ })
750
759
if err != nil {
751
760
switch err .(type ) {
752
761
case errtypes.NotFound :
0 commit comments