Skip to content

Fix fragile arguments.length check in findByEmailOrUsername#3932

Open
SinhaS12 wants to merge 3 commits intoprocessing:developfrom
SinhaS12:fix/User-Model
Open

Fix fragile arguments.length check in findByEmailOrUsername#3932
SinhaS12 wants to merge 3 commits intoprocessing:developfrom
SinhaS12:fix/User-Model

Conversation

@SinhaS12
Copy link

@SinhaS12 SinhaS12 commented Feb 24, 2026

Issue:

Fixes #3911
findByEmailOrUsername() used arguments.length === 2 to decide whether to run a case-insensitive query. This is fragile and can behave inconsistently when the function is called with extra arguments (e.g. wrappers) or different call styles.

Demo:

N/A (server-side logic change; no UI change).

Changes:

  • Remove the arguments.length === 2 condition from the case-insensitive branch.
  • Control case-insensitive behavior by explicitly checking options?.caseInsensitive.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • has no typecheck errors (npm run typecheck)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User model: fragile use of arguments.length in findByEmailOrUsername

1 participant