docx-validate
    Preparing search index...

    Function partNameViolation

    • Why a part name is not a valid OPC part name (ECMA-376 Part 2, 4th edition (2012), §9.1.1.1, [M1.1]–[M1.10]), or undefined when it names one.

      A part name shall be an IRI and shall be encoded as either a Part URI (§9.1.1.1.2: segment = 1*( pchar ), RFC 3986) or a Part IRI (§9.1.1.1.1: isegment = 1*( ipchar ), RFC 3987, which allows a literal ucschar). A name is valid when it is either, so /word/café.xml (a Part IRI) and /word/caf%C3%A9.xml (a Part URI) both pass, while a mixed spelling like /word/caf%C3%A9-é.xml fails both: its literal ucschar leaves only the Part IRI form, whose [M1.8] forbids percent-encoded iunreserved characters. A literal non-ASCII character that is not ucschar (a C1 control, private use, a noncharacter) is in neither grammar. Strict validation follows this 4th edition, the edition of the bundled schemas/ecma/fourth-edition/ OPC schemas; the 5th edition (§6.2.2.2) keeps only the IRI form and forbids %C3%A9 instead.

      A part name is a path: it starts with /, its segments are neither empty nor made only of dots ([M1.10]), it ends with no separator and no segment ends with a dot, it carries no query, fragment or backslash, and every character in it is an RFC 3986 pchar, an RFC 3987 ipchar, or a percent-escape. A percent-escaped separator ([M1.7]) or unreserved character ([M1.8]) is forbidden too.

      A folder segment ending with a dot (PART_NAME_FOLDER_SEGMENT_DOT) is judged last, and a segment made only of dots never reaches it (#453). Word 16.115 opens such a name clean while it refuses every other violation (#450), so a name that breaks another rule as well reports that rule.

      These are the part-name rules, not the stored item-name rules: a part name starts with a slash, where a stored item name must not.

      Parameters

      • partName: string

      Returns string | undefined