这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rolandwalker
Copy link
Contributor

Description

Use Nones to detect when unset, because the empty string is a valid password. In particular

passwd = passwd or password_from_file

would have used password_from_file if passwd was the (falsey) empty string.

It probably worked as expected because password_from_file was also returning the empty string when not available, but that is an awkward place to put the true default.

I'm not yet smart enough to write a meaningful test for the CLI behavior, but did exercise this locally.

Checklist

  • I've added this contribution to the changelog.md.
  • I've added my name to the AUTHORS file (or it's already there).
  • I ran uv run ruff check && uv run ruff format to lint and format the code.

@rolandwalker rolandwalker self-assigned this Aug 16, 2025
Use Nones to detect when unset, because the empty string is a valid
password.  In particular

    passwd = passwd or password_from_file

would have used password_from_file if passwd was the (falsey) empty
string.
@rolandwalker rolandwalker force-pushed the RW/better-handle-empty-passwords branch from 9c2b835 to 54d2ebd Compare August 16, 2025 12:54
@rolandwalker rolandwalker merged commit 94b6675 into main Aug 16, 2025
8 checks passed
@rolandwalker rolandwalker deleted the RW/better-handle-empty-passwords branch August 16, 2025 12:59
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.

2 participants