@@ -51,16 +51,16 @@ const removeFromDirectory = async (context, options) => {
5151 const format = mc [ options . format . toUpperCase ( ) . replace ( / - / g, '_' ) ]
5252 const hashAlg = mh . names [ options . hashAlg ]
5353
54- const newParentNode = await DAGNode . rmLink ( options . parent , options . name )
55- const cid = await context . ipld . put ( newParentNode , format , {
54+ options . parent . rmLink ( options . name )
55+ const cid = await context . ipld . put ( options . parent , format , {
5656 cidVersion : options . cidVersion ,
5757 hashAlg
5858 } )
5959
6060 log ( `Updated regular directory ${ cid } ` )
6161
6262 return {
63- node : newParentNode ,
63+ node : options . parent ,
6464 cid
6565 }
6666}
@@ -104,11 +104,11 @@ const updateShard = async (context, positions, child, options) => {
104104 if ( link . Name === `${ prefix } ${ child . name } ` ) {
105105 log ( `Removing existing link ${ link . Name } ` )
106106
107- const newNode = await DAGNode . rmLink ( node , link . Name )
107+ node . rmLink ( link . Name )
108108
109109 await bucket . del ( child . name )
110110
111- return updateHamtDirectory ( context , newNode . Links , bucket , options )
111+ return updateHamtDirectory ( context , node . Links , bucket , options )
112112 }
113113
114114 log ( `Descending into sub-shard ${ link . Name } for ${ prefix } ${ child . name } ` )
@@ -135,8 +135,8 @@ const updateShard = async (context, positions, child, options) => {
135135}
136136
137137const updateShardParent = async ( context , bucket , parent , oldName , newName , size , cid , options ) => {
138- parent = await DAGNode . rmLink ( parent , oldName )
139- parent = await DAGNode . addLink ( parent , new DAGLink ( newName , size , cid ) )
138+ parent . rmLink ( oldName )
139+ parent . addLink ( new DAGLink ( newName , size , cid ) )
140140
141141 return updateHamtDirectory ( context , parent . Links , bucket , options )
142142}
0 commit comments