MongoDatabase.ValidateDatabaseName() check for invalid characters is too soft.

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • 1.3
    • Affects Version/s: 1.2
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      That is what it uses as invalid characters:
      if (name.IndexOfAny(new char[]

      { '\0', ' ', '.', '$', '/', '\\' }

      ) != -1) { ...

      Apparently this is not enough. For example it allowed me to create a database "*" and even add a collection and some data. Nothing was found on my disk, indeed, and no exceptions were thrown.

      As far as database names are used as parts of file system names, more characters should be added to invalid. Perhaps System.IO.Path.GetInvalidFileNameChars() is too much but at least some of them like <>?*|": are candidates.

              Assignee:
              Robert Stam
              Reporter:
              Roman Kuzmin
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: