fix(Read/Write Files from Disk Node): Notice update in file selector, replace backslashes with forward slashes if windows path (#10186)

This commit is contained in:
Michael Kret 2024-07-25 16:55:40 +03:00 committed by GitHub
parent eb9c69c595
commit 3eac673b17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,7 +13,8 @@ export const properties: INodeProperties[] = [
required: true,
placeholder: 'e.g. /home/user/Pictures/**/*.png',
hint: 'Supports patterns, learn more <a href="https://github.com/micromatch/picomatch#basic-globbing" target="_blank">here</a>',
description: "Specify a file's path or path pattern to read multiple files",
description:
"Specify a file's path or path pattern to read multiple files. Always use forward-slashes for path separator even on Windows.",
},
{
displayName: 'Options',
@ -73,7 +74,12 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
try {
fileSelector = this.getNodeParameter('fileSelector', itemIndex) as string;
fileSelector = String(this.getNodeParameter('fileSelector', itemIndex));
if (/^[a-zA-Z]:/.test(fileSelector)) {
fileSelector = fileSelector.replace(/\\\\/g, '/');
}
const options = this.getNodeParameter('options', itemIndex, {});
let dataPropertyName = 'data';