mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(HTTP Request Node): Errorneous binary object without content-disposition response header (#8583)
Co-authored-by: Marcus <marcus@n8n.io>
This commit is contained in:
parent
de6d466e5e
commit
e28b374170
|
@ -1810,8 +1810,8 @@ export class HttpRequestV3 implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const responseContentType = response.headers['content-type'] ?? '';
|
||||||
if (autoDetectResponseFormat) {
|
if (autoDetectResponseFormat) {
|
||||||
const responseContentType = response.headers['content-type'] ?? '';
|
|
||||||
if (responseContentType.includes('application/json')) {
|
if (responseContentType.includes('application/json')) {
|
||||||
responseFormat = 'json';
|
responseFormat = 'json';
|
||||||
if (!response.__bodyResolved) {
|
if (!response.__bodyResolved) {
|
||||||
|
@ -1890,7 +1890,22 @@ export class HttpRequestV3 implements INodeType {
|
||||||
newItem.json = items[itemIndex].json;
|
newItem.json = items[itemIndex].json;
|
||||||
binaryData = response;
|
binaryData = response;
|
||||||
}
|
}
|
||||||
newItem.binary![outputPropertyName] = await this.helpers.prepareBinaryData(binaryData);
|
const preparedBinaryData = await this.helpers.prepareBinaryData(
|
||||||
|
binaryData,
|
||||||
|
undefined,
|
||||||
|
responseContentType || undefined,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!preparedBinaryData.fileName &&
|
||||||
|
preparedBinaryData.fileExtension &&
|
||||||
|
typeof requestOptions.uri === 'string' &&
|
||||||
|
requestOptions.uri.endsWith(preparedBinaryData.fileExtension)
|
||||||
|
) {
|
||||||
|
preparedBinaryData.fileName = requestOptions.uri.split('/').pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
newItem.binary![outputPropertyName] = preparedBinaryData;
|
||||||
|
|
||||||
returnItems.push(newItem);
|
returnItems.push(newItem);
|
||||||
} else if (responseFormat === 'text') {
|
} else if (responseFormat === 'text') {
|
||||||
|
|
Loading…
Reference in a new issue