File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
backend/src/useCases/objects Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ const retrieveAndReassembleFile = async (
143143 if ( metadata . totalChunks === 1 ) {
144144 const chunkData = await NodesUseCases . getChunkData ( metadata . chunks [ 0 ] . cid )
145145 if ( ! chunkData ) {
146- throw new Error ( ' Chunk not found' )
146+ throw new Error ( ` Chunk not found: cid= ${ metadata . chunks [ 0 ] . cid } ` )
147147 }
148148
149149 return Readable . from ( chunkData )
@@ -167,7 +167,7 @@ const retrieveAndReassembleFile = async (
167167 )
168168
169169 if ( chunkedData . some ( ( e ) => e === undefined ) ) {
170- this . destroy ( new Error ( ' Chunk not found' ) )
170+ this . destroy ( new Error ( ` Chunk not found: cid= ${ chunks [ 0 ] . cid } ` ) )
171171 return
172172 }
173173
Original file line number Diff line number Diff line change @@ -69,7 +69,13 @@ const getChunkData = async (cid: string | CID): Promise<Buffer | undefined> => {
6969
7070 let ipldNodeBytes : Buffer | undefined = await nodesRepository
7171 . getNode ( cidString )
72- . then ( ( e ) => ( e ? Buffer . from ( e . encoded_node , 'base64' ) : undefined ) )
72+ . then ( ( e ) => {
73+ if ( ! e || ! e . encoded_node ) {
74+ return undefined
75+ }
76+
77+ return Buffer . from ( e . encoded_node , 'base64' )
78+ } )
7379
7480 if ( ! ipldNodeBytes ) {
7581 ipldNodeBytes = await BlockstoreUseCases . getNode ( cidString )
You can’t perform that action at this time.
0 commit comments