Skip to content

Bug when using a password with special chars in the url passed to nano #363

Closed

Description

@domachine

Hi,

I think I encountered a bug when passing a url with embedded credentials (url.username and url.password) to nano. I always get an unauthorized error from couchdb when having special chars in the password. This does not happen if the password does not have special chars. I peeked a bit in the source code and found that the URL constructor is used to read the password which is then encoded in the authorization header.

I did some tests and I think the problem is that the password property returns the password in percent encoding (which is not intuitive to me since the searchParams are decoded when reading 🤷‍♂️). This behavior is also described on MDN:

The password is percent-encoded when setting but not percent-decoded when reading.

Am I missing something?

Note: I'm using the "new" nano 11.

Thank you very much for the time and effort you put into couchdb and the ecosystem ❤️.

Activity

  1. glynnbird commented on Feb 6, 2026

    @glynnbird
    Contributor

    Thanks for the report.

    I did manage to reproduce this. It turns out that Node.js's new URL returns a percent-encoded password and percent-encoded username so I'll have to take that into account.

  2. glynnbird commented on Feb 6, 2026

    @glynnbird
    Contributor

    Fixed in nano@11.0.4

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions