Skip to content

fix: align PROPFIND/PROPPATCH metadata keys with Graph Metadata API#693

Open
flash7777 wants to merge 4 commits into
opencloud-eu:mainfrom
flash7777:fix/propfind-arbitrary-metadata-keys
Open

fix: align PROPFIND/PROPPATCH metadata keys with Graph Metadata API#693
flash7777 wants to merge 4 commits into
opencloud-eu:mainfrom
flash7777:fix/propfind-arbitrary-metadata-keys

Conversation

@flash7777

Copy link
Copy Markdown

Summary

The Graph Metadata API (/graph/v1beta1/drives/{driveID}/items/{itemID}/metadata) stores arbitrary metadata using short keys (e.g. oy.fileReference), which are persisted as xattrs like user.oc.md.oy.fileReference.

However, PROPFIND and PROPPATCH use full namespace URI keys (e.g. http://owncloud.org/ns/oy.fileReference), causing a key mismatch:

  • Properties set via the Metadata API cannot be read via PROPFIND (404)
  • Properties set via PROPPATCH cannot be read via the Metadata API
  • The two APIs write to the same xattr namespace (user.oc.md.*) but with incompatible key formats

Changes

propfind.go:

  • requiresExplicitFetching: return true for all oc: namespace properties (was false for unknown ones, preventing metadata fetch entirely)
  • metadataKeyOf: use n.Local directly for oc: namespace instead of fmt.Sprintf("%s/%s", n.Space, n.Local) — matches how the Graph API stores keys

proppatch.go:

  • Same key format change: use local name for oc: namespace, full URI for other namespaces

Before / After

<!-- PROPFIND request -->
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
  <d:prop>
    <oc:oy.fileReference/>
  </d:prop>
</d:propfind>

Before: 404 Not Found (property not fetched, key mismatch)
After: 200 OK with value 11.03

Impact

  • No change for built-in properties (audio, image, tags, etc.) — they have dedicated handling
  • Enables PROPFIND access to custom metadata set via Graph Metadata API
  • Makes PROPPATCH-set metadata consistent with Metadata API format
  • Non-oc: namespaces are unchanged (still use full URI keys)

flash added 4 commits June 18, 2026 21:45
The Graph Metadata API stores arbitrary metadata using short keys
(e.g. "oy.fileReference"), but PROPFIND and PROPPATCH used full
namespace URI keys (e.g. "http://owncloud.org/ns/oy.fileReference").
This mismatch meant properties set via the Metadata API could never
be read via PROPFIND, and vice versa.

Changes:
- requiresExplicitFetching: allow all oc: namespace properties to
  trigger metadata fetching (was hardcoded to known properties only)
- metadataKeyOf: use local name directly for oc: namespace instead
  of prefixing with the full namespace URI
- proppatch: same key format change for consistency

This enables reading custom metadata (set via Graph API) in standard
WebDAV PROPFIND responses, e.g.:
  <oc:oy.fileReference/> → returns "11.03"
The allprop handler only output known metadata keys (tags, audio,
location, image, photo). Arbitrary custom metadata set via the
Graph Metadata API was silently omitted. Now all non-empty custom
metadata keys are included in the allprop response.
…g 404

The oc: namespace default case in mdToPropResponse immediately returned
404 for unknown properties without checking ArbitraryMetadata. Only
non-oc/non-DAV namespaces had the metadata lookup. Now unknown oc:
properties are looked up in ArbitraryMetadata before returning 404.
- Walker: ListContainer with ArbitraryMetadataKeys: ["*"] so search
  indexing receives custom metadata (e.g. oy.fileReference)
- propfind: oc: namespace default looks up ArbitraryMetadata before 404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant