Skip to content

incorrect operation of the if condition #22858

@Mikhail-Martynowich

Description

@Mikhail-Martynowich

Bug Description

startsWith("qwerty") returns true for a string that begins with "Чему бы ты хотел научиться..."

To Reproduce

code node:

input: Чему бы ты хотел научиться в рамках работы над текущим учебным проектом или в рамках подготовки к собеседованию и трудоустройству?

code:
const data = $getWorkflowStaticData('global');
const response = $input.first().json.output;

if (!data.memory) {
data.memory = {
status: 'initial',
plan: '',
};
}

if (response.startsWith("План")) {
data.memory.plan = response;
}

if (response.startsWith("qwerty")) {
data.memory.status = 'ready';
}

return [
{
json: {
status: data.memory.status,
plan: data.memory.plan,
}
}
]

output:
status: ready
plan: Начинаю поиск информации

Expected behavior

if (response.startsWith("qwerty")) {
data.memory.status = 'ready';
}
I expect the "if" condition to fail for the line starting with "Чему бы ты хотел научиться в рамках работы над текущим учебным проектом или в рамках подготовки к собеседованию и трудоустройству?"

Debug Info

///

Operating System

windows 10

n8n Version

1.86.0

Node.js Version

Code node version 2 (Latest)

Database

SQLite (default)

Execution mode

main (default)

Hosting

self hosted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions