Skip to content

Commit d1d4dd7

Browse files
committed
Fix blob transfer destination
Signed-off-by: Gabriel Indik <[email protected]>
1 parent a4945bc commit d1d4dd7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/routers/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ router.post('/transfers', async (req, res, next) => {
279279
throw new RequestError('Missing recipient', 400);
280280
}
281281
let recipientEndpoint: string;
282-
recipientEndpoint = config.p2p.endpoint ?? `https://${config.p2p.hostname}:${config.p2p.port}`;
283282
if (recipientID === peerID) {
283+
recipientEndpoint = config.p2p.endpoint ?? `https://${config.p2p.hostname}:${config.p2p.port}`;
284284
} else {
285285
let recipientPeer = config.peers.find(peer => peer.id === recipientID);
286286
if (recipientPeer === undefined) {
@@ -289,6 +289,7 @@ router.post('/transfers', async (req, res, next) => {
289289
if (recipientDestination !== undefined && !recipientPeer.destinations?.includes(recipientDestination)) {
290290
throw new RequestError(`Unknown recipient destination expected=${recipientPeer.destinations?.join('|')} recieved=${recipientDestination}`, 400);
291291
}
292+
recipientEndpoint = recipientPeer.endpoint;
292293
}
293294
let requestId = uuidV4();
294295
if (typeof req.body.requestId === 'string') {

0 commit comments

Comments
 (0)