From 7566d658d48dc64915b72094cfad71734f9a07a6 Mon Sep 17 00:00:00 2001 From: sanjai0py Date: Tue, 11 Feb 2025 11:51:24 +0530 Subject: [PATCH] Fix: Prevent interpolation of buffer values in JSON requests --- packages/bruno-electron/src/ipc/network/interpolate-vars.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/bruno-electron/src/ipc/network/interpolate-vars.js b/packages/bruno-electron/src/ipc/network/interpolate-vars.js index 2b46327af..0b8e300ed 100644 --- a/packages/bruno-electron/src/ipc/network/interpolate-vars.js +++ b/packages/bruno-electron/src/ipc/network/interpolate-vars.js @@ -65,7 +65,11 @@ const interpolateVars = (request, envVariables = {}, runtimeVariables = {}, proc const contentType = getContentType(request.headers); - if (contentType.includes('json')) { + /* + We explicitly avoid interpolating buffer values because the file content is read as a buffer object in raw body mode. + Even if the selected file's content type is JSON, this prevents the buffer object from being interpolated. + */ + if (contentType.includes('json') && !Buffer.isBuffer(request.data)) { if (typeof request.data === 'string') { if (request.data.length) { request.data = _interpolate(request.data);