@@ -143,8 +143,10 @@ func cleanup(c *cli.Context, cfg *config.Config) error {
143143// │ └── a9/a5/4c/e7/-de30-4d27-94f8-10e4612c66c2.mpk (Phase 3: parent node for ancestry lookup)
144144// │ {"user.ocis.name": "einstein", "user.ocis.id": "a9a54ce7-...", "user.ocis.parentid": "...users-node-id..."}
145145// └── uploads/ (rootMetadataUploads)
146- // └── d702d7e1-37b0-4d41-b8dc-4b90c1d1f907 (Phase 1: read <spaceID>.json blob for Shares data; blobUploadsPath = filepath.Join(rootMetadataUploads, blobID))
147- // {"Shares": {"215fee7a-...:480049db-...:84652da9-...": {resource_id: {...}, grantee: {...}, creator: {...}}}}
146+ // ├── d702d7e1-37b0-4d41-b8dc-4b90c1d1f907 (Phase 1: read <spaceID>.json blob for Shares data; blobUploadsPath = filepath.Join(rootMetadataUploads, blobID))
147+ // │ {"Shares": {"215fee7a-...:480049db-...:84652da9-...": {resource_id: {...}, grantee: {...}, creator: {...}}}}
148+ // └── 1c93b82b-d22d-41e0-8038-5a706e9b409e.info
149+ // {"MetaData": {"dir": "/users/4c510ada-c86b-4815-8820-42cdf82c3d51", "filename": "received.json", ...}, "Storage": {"NodeName": "received.json", "SpaceRoot": "jsoncs3-share-manager-metadata", ...}}
148150
149151func moveStuckUploadBlobsCmd (cfg * config.Config ) * cli.Command {
150152 return & cli.Command {
@@ -286,11 +288,11 @@ func restoreFromUploads(rootMetadataUploads string, missing map[string]string, d
286288 continue
287289 }
288290
291+ // Check if the blob exists in the uploads folder and move it to the share manager metadata blobs/ folder
289292 if _ , err := os .Stat (blobUploadsPath ); err != nil {
290293 fmt .Printf (" Blob %s: not found in %s\n " , blobID , blobUploadsPath )
291294 continue
292295 }
293-
294296 fmt .Printf (" Move %s to %s\n " , blobUploadsPath , blobPathAbs )
295297 if err := os .MkdirAll (filepath .Dir (blobPathAbs ), 0755 ); err != nil {
296298 fmt .Printf (" Warning: Failed to create dir: %v\n " , err )
@@ -301,6 +303,17 @@ func restoreFromUploads(rootMetadataUploads string, missing map[string]string, d
301303 continue
302304 }
303305
306+ // Remove the info file after the blob is moved
307+ infoPath := blobUploadsPath + ".info"
308+ if _ , err := os .Stat (infoPath ); err != nil {
309+ fmt .Printf (" Info file %s: not found\n " , infoPath )
310+ continue
311+ }
312+ if err := os .Remove (infoPath ); err != nil {
313+ fmt .Printf (" Warning: Failed to remove info file: %v\n " , err )
314+ continue
315+ }
316+
304317 remainingBlobIDs [blobID ] = false
305318 }
306319
0 commit comments