File tree 1 file changed +5
-11
lines changed
1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,8 @@ func (adder *Adder) Finalize() (ipld.Node, error) {
201
201
return nil , err
202
202
}
203
203
var root mfs.FSNode
204
- root = mr .GetDirectory ()
204
+ rootdir := mr .GetDirectory ()
205
+ root = rootdir
205
206
206
207
err = root .Flush ()
207
208
if err != nil {
@@ -210,7 +211,7 @@ func (adder *Adder) Finalize() (ipld.Node, error) {
210
211
211
212
var name string
212
213
if ! adder .Wrap {
213
- children , err := root .( * mfs. Directory ) .ListNames (adder .ctx )
214
+ children , err := rootdir .ListNames (adder .ctx )
214
215
if err != nil {
215
216
return nil , err
216
217
}
@@ -219,16 +220,9 @@ func (adder *Adder) Finalize() (ipld.Node, error) {
219
220
return nil , fmt .Errorf ("expected at least one child dir, got none" )
220
221
}
221
222
223
+ // Replace root with the first child
222
224
name = children [0 ]
223
-
224
- mr , err := adder .mfsRoot ()
225
- if err != nil {
226
- return nil , err
227
- }
228
-
229
- dir := mr .GetDirectory ()
230
-
231
- root , err = dir .Child (name )
225
+ root , err = rootdir .Child (name )
232
226
if err != nil {
233
227
return nil , err
234
228
}
You can’t perform that action at this time.
0 commit comments