mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
fix(Microsoft Excel 365 Node): Support for more extensions in workbook rlc (#7020)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
parent
0356419c1a
commit
d6e1cf232f
|
@ -11,7 +11,10 @@ export async function searchWorkbooks(
|
||||||
filter?: string,
|
filter?: string,
|
||||||
paginationToken?: string,
|
paginationToken?: string,
|
||||||
): Promise<INodeListSearchResult> {
|
): Promise<INodeListSearchResult> {
|
||||||
const q = filter ? encodeURI(`.xlsx AND ${filter}`) : '.xlsx';
|
const fileExtensions = ['.xlsx', '.xlsm', '.xlst'];
|
||||||
|
const extensionFilter = fileExtensions.join(' OR ');
|
||||||
|
|
||||||
|
const q = filter || extensionFilter;
|
||||||
|
|
||||||
let response: IDataObject = {};
|
let response: IDataObject = {};
|
||||||
|
|
||||||
|
@ -37,10 +40,22 @@ export async function searchWorkbooks(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.value && filter) {
|
||||||
|
response.value = (response.value as IDataObject[]).filter((workbook: IDataObject) => {
|
||||||
|
return fileExtensions.some((extension) => (workbook.name as string).includes(extension));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
results: (response.value as IDataObject[]).map((workbook: IDataObject) => {
|
results: (response.value as IDataObject[]).map((workbook: IDataObject) => {
|
||||||
|
for (const extension of fileExtensions) {
|
||||||
|
if ((workbook.name as string).includes(extension)) {
|
||||||
|
workbook.name = (workbook.name as string).replace(extension, '');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
name: (workbook.name as string).replace('.xlsx', ''),
|
name: workbook.name as string,
|
||||||
value: workbook.id as string,
|
value: workbook.id as string,
|
||||||
url: workbook.webUrl as string,
|
url: workbook.webUrl as string,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue