mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor: Automatically add fileExtension from FileTypeResult to binary data (#3591)
* ♻️ Add fileExtension from FileTypeResult to buffer data * ⚡ Minor improvement Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -809,6 +809,7 @@ export async function prepareBinaryData(
|
||||
filePath?: string,
|
||||
mimeType?: string,
|
||||
): Promise<IBinaryData> {
|
||||
let fileExtension: string | undefined;
|
||||
if (!mimeType) {
|
||||
// If no mime type is given figure it out
|
||||
|
||||
@@ -825,6 +826,7 @@ export async function prepareBinaryData(
|
||||
const fileTypeData = await fromBuffer(binaryData);
|
||||
if (fileTypeData) {
|
||||
mimeType = fileTypeData.mime;
|
||||
fileExtension = fileTypeData.ext;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -836,6 +838,7 @@ export async function prepareBinaryData(
|
||||
|
||||
const returnData: IBinaryData = {
|
||||
mimeType,
|
||||
fileExtension,
|
||||
data: '',
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user