mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 17:14:05 -08:00
bugfix wrong uploadurl for images/files
This commit is contained in:
parent
e791055fcd
commit
f4e999521c
|
@ -19,6 +19,8 @@ export async function upload(
|
||||||
'GET',
|
'GET',
|
||||||
'/api/v2.1/dtable/app-upload-link/',
|
'/api/v2.1/dtable/app-upload-link/',
|
||||||
)) as IUploadLink;
|
)) as IUploadLink;
|
||||||
|
const relativePath =
|
||||||
|
uploadColumnType === 'image' ? uploadLink.img_relative_path : uploadLink.file_relative_path;
|
||||||
|
|
||||||
// Get the binary data
|
// Get the binary data
|
||||||
const fileBufferData = await this.helpers.getBinaryDataBuffer(index, dataPropertyName);
|
const fileBufferData = await this.helpers.getBinaryDataBuffer(index, dataPropertyName);
|
||||||
|
@ -35,8 +37,7 @@ export async function upload(
|
||||||
},
|
},
|
||||||
parent_dir: uploadLink.parent_path,
|
parent_dir: uploadLink.parent_path,
|
||||||
replace: '0',
|
replace: '0',
|
||||||
relative_path:
|
relative_path: relativePath,
|
||||||
uploadColumnType === 'image' ? uploadLink.img_relative_path : uploadLink.file_relative_path,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,12 +62,10 @@ export async function upload(
|
||||||
} as IDataObject;
|
} as IDataObject;
|
||||||
let rowInput = {} as IRowObject;
|
let rowInput = {} as IRowObject;
|
||||||
|
|
||||||
const filePath = [
|
const filePath = `/workspace/${workspaceId}${uploadLink.parent_path}/${relativePath}/${uploadAsset[c].name}`;
|
||||||
`/workspace/${workspaceId}${uploadLink.parent_path}/${uploadLink.img_relative_path}/${uploadAsset[c].name}`,
|
|
||||||
];
|
|
||||||
|
|
||||||
if (uploadColumnType === 'image') {
|
if (uploadColumnType === 'image') {
|
||||||
rowInput[uploadColumn.split(':::')[0]] = filePath;
|
rowInput[uploadColumn.split(':::')[0]] = [filePath];
|
||||||
} else if (uploadColumnType === 'file') {
|
} else if (uploadColumnType === 'file') {
|
||||||
rowInput[uploadColumn.split(':::')[0]] = uploadAsset;
|
rowInput[uploadColumn.split(':::')[0]] = uploadAsset;
|
||||||
uploadAsset[c].type = 'file';
|
uploadAsset[c].type = 'file';
|
||||||
|
|
Loading…
Reference in a new issue