Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-469

Server cannot connect with password carrying '@' character.

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.4.2
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      If the password carries '@' character in the connection string, the connection doesn't happen and throws error.

      E.g if the password is 'somepassword1@' in a connection string, it returns only 'somepassword1'. So, this password fails to connect to the database.

      FileName : MongoUrlBuilder.cs
      Git Path: https://github.com/mongodb/mongo-csharp-driver/blob/master/Driver/Core/MongoUrlBuilder.cs
      Line 438-441
      const string pattern =
      @"^mongodb://" +
      @"((?<username>[^:])?<password>[^@])@)?" +
      @"(?<servers>" + serverPattern + "(," + serverPattern + ")*)" +
      @"(/(?<database>[^?]+)?(?(?<query>.*))?)?$";
      Match match = Regex.Match(url, pattern);

      Thanks,
      Prithiraj

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            prithiraj Prithiraj Sengupta
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: