Skip to content

Broken Regex Pattern in Manifest Schema #1030

Description

@JakeSmarter

EntryDll

"pattern": "^[a-zA-Z0-9_.-]+\\.dll$",

  • DLL and assembly names can and should be allowed any ordinary file name characters, except for forbidden characters "*/:<>?\|.
  • Assembly names are case insensitive. Note that the current pattern accepts lower case file name extensions only: .dll but not .DLL or .dLl etc.
  • Keep in mind that the . character in regular expressions is a class character that denotes any character. This renders every other character in the custom [] character class ineffective in the current pattern. If you want to express a period rather than any character then you must escape it with a \ backslash.
  • File names must not start with a . period character.
  • Reserved file names exist.

Please update the pattern to:

{
    "pattern": "^(?!(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|(?:[Cc][Oo][Mm]|[Ll][Pp][Tt])[1-9])\\.[Dd][Ll][Ll]$)[^\\\\/:*?\"<>|]+\\.[Dd][Ll][Ll]$"

}

Or, if assemblies can also be put in sub-folders:

{
    "pattern": "^(?!(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|(?:[Cc][Oo][Mm]|[Ll][Pp][Tt])[1-9])(?:\\\\|\\.[Dd][Ll]{2}$))(?!.*\\\\(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|(?:[Cc][Oo][Mm]|[Ll][Pp][Tt])[1-9])(?:\\\\|\\.))(?:[^\\\\/:*?\"<>|]+\\\\)*[^\\\\/:*?\"<>|]+\\.[Dd][Ll]{2}$"
}

UniqueID (ModID definition)

"pattern": "^[a-zA-Z0-9_.-]+$",

  • Accepts every character due to . not being \ backslash escaped in the custom [] character class.
  • Accepts leading . periods, e.g. .Creator.ModName.
  • Accepts consecutive periods, e.g. ..Creator...ModName.
  • Accepts trailing . periods, e.g. .Creator..ModName..
  • Accepts leading _ and - characters, which is something you probably do not want either.

Generally speaking, UniqueID should probably follow .NET namespace rules, which among other notable things do not accept the - minus character in particular. If .NET namespace rules are good enough for the .NET platform then they are most probably also good enough for UniqueID. Having said that, there is also no reason to limit UniqueID to the Latin alphabet only. Please update the pattern to:

{
  "pattern": "^\\p{L}[\\p{L}\\p{N}_]*(\\.[\\p{L}][\\p{L}\\p{N}_]*)*$"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions