Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2644

The Percent Encoded Password Connectstring is not parsed correctly in the topology at Connect time

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: 1.11.0, 1.10.4
    • Labels:

      Summary

      In topology.go (v1.11.0) line 239 connection string t.cfg.URI is parsed with generic url.Parse(...) instead of connstring.Parse(...)

      If connection string contains Percent Encoded Password reports error (as example)

      parse "mongodb+srv://user:test%2F%40": invalid port ":test%2F%40" after host

      in func (t *Topology) Connect() error {...} 

      How to Reproduce

      Is possible to reproduce using mongo Client Connect with a connection string with these characteristics

      func TestURI(t *testing.T)

      {   uri0 := "mongodb+srv://user:test%2F%40pwd@myatlasproject.mongodb.net/admin?retryWrites=true&w=majority"   uri, err := url.Parse(uri0)   // uri, err := connstring.Parse(uri0)   assert.NoError(t, err)   fmt.Println(uri) }

      Additional Background

      I suggest replacing the command in topology.go [line 239 in function Connect()]

      uri, err := url.Parse(t.cfg.URI)

      with 

      uri, err := connstring.Parse(t.cfg.URI)

       

      NOTE:

      I have set the bug as a blocker because it does not allow me to keep the library up to date, but I don't know if it matches your priority criteria

            Assignee:
            Unassigned Unassigned
            Reporter:
            m.rozzati@teamsystem.com Marco Rozzati
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: