Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/server/src/services/documentstore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ const saveProcessingLoader = async (
if (!data.splitterId) data.splitterId = found.splitterId
if (!data.splitterName) data.splitterName = found.splitterName
if (!data.splitterConfig) data.splitterConfig = found.splitterConfig
if (found.credential) {
if (!data.credential && found.credential) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the repository's general rules, loose equality (== null) should be used as a standard idiom for a 'nullish' check that covers both null and undefined. Using !data.credential might also incorrectly treat other falsy values (like an empty string "") as nullish, which could prevent users from explicitly clearing a credential if that is represented by an empty string.

Suggested change
if (!data.credential && found.credential) {
if (data.credential == null && found.credential) {
References
  1. In JavaScript/TypeScript, use loose equality (== null) as a standard idiom for a 'nullish' check that covers both null and undefined.

data.credential = found.credential
}

Expand Down