File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ export class Download extends RootCommand implements LeafCommand {
3030
3131 private async downloadData ( ) : Promise < void > {
3232 let response : Bytes
33+ let nameOverride : string | undefined
3334
3435 if ( this . manifestDownload . act ) {
3536 const responseAct = await this . bee . downloadFile ( this . address . hash , this . manifestDownload . destination , {
@@ -39,13 +40,19 @@ export class Download extends RootCommand implements LeafCommand {
3940 } )
4041 response = responseAct . data
4142 } else {
42- response = await this . bee . downloadData ( this . address . hash , undefined )
43+ if ( this . address . hash . length === 128 ) {
44+ const fileData = await this . bee . downloadFile ( this . address . hash , undefined )
45+ nameOverride = fileData . name
46+ response = fileData . data
47+ } else {
48+ response = await this . bee . downloadData ( this . address . hash , undefined )
49+ }
4350 }
4451
4552 if ( this . manifestDownload . stdout ) {
4653 process . stdout . write ( response . toUtf8 ( ) )
4754 } else {
48- const path = this . manifestDownload . destination || this . address . hash
55+ const path = this . manifestDownload . destination || nameOverride || this . address . hash
4956 await fs . promises . writeFile ( path , response . toUint8Array ( ) )
5057 }
5158 }
You can’t perform that action at this time.
0 commit comments