Skip to content

docProps core/app properties are read by name, not through their root relationships #1340

Description

@Mearman

Same shape as #1314, one relationship over. packages/ooxml.js/src/typed/shared/metadata.ts reads docProps/core.xml and docProps/app.xml by name:

const CORE_PROPERTIES_PATH = "docProps/core.xml";
const APP_PROPERTIES_PATH = "docProps/app.xml";

OPC names both through root relationships (.../package/2006/relationships/metadata/core-properties and .../officeDocument/2006/relationships/extended-properties), so a package that puts its core properties somewhere else reads as having no metadata at all: readCoreProperties returns every field undefined, silently, for all three formats.

hasCoreProperties and patchCoreProperties in the same file have it too, and they matter more than the read: patchCoreProperties throws package has no 'docProps/core.xml' XML part to patch for a package that does have core properties under another name, and documents.js's setDocumentMetadata fast path gates on hasCoreProperties. All three need to resolve the same path or the gate and the patch disagree.

findMainPartPath in typed/opc.ts is the equivalent resolver for the main part; this wants the same treatment against the two metadata relationship types. Worth checking documents.js's own src/opc/core-properties.ts (addCoreProperties) at the same time, since it creates the part and declares the relationship.

I have not checked whether any real-world producer actually renames these, unlike #1314 where a client file did.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions