File tree Expand file tree Collapse file tree
src/components/httpRoutes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,9 +106,23 @@ directCommandRoute.post(
106106 res . end ( )
107107 } else if ( hasP2PInterface ) {
108108 // Remote command - use P2P sendTo
109+ let { multiAddrs } = req . body
110+ if ( typeof multiAddrs === 'string' ) {
111+ if ( multiAddrs . startsWith ( '[' ) ) {
112+ try {
113+ const parsed = JSON . parse ( multiAddrs )
114+ multiAddrs = Array . isArray ( parsed ) ? parsed : [ multiAddrs ]
115+ } catch {
116+ multiAddrs = [ multiAddrs ]
117+ }
118+ } else {
119+ multiAddrs = [ multiAddrs ]
120+ }
121+ }
122+
109123 const response = await req . oceanNode
110124 . getP2PNode ( )
111- . sendTo ( req . body . node as string , JSON . stringify ( req . body ) , req . body . multiAddrs )
125+ . sendTo ( req . body . node as string , JSON . stringify ( req . body ) , multiAddrs )
112126
113127 res . status ( response . status . httpStatus )
114128 if ( response . status . headers ) {
You can’t perform that action at this time.
0 commit comments