feat(web-client): key custom props by namespace - #3301
Draft
dschmidt wants to merge 2 commits into
Draft
Conversation
Props were parsed with namespaces stripped, so two apps using the same
property name in different namespaces collapsed onto one key and their values
were merged into an array. registerExtraProp documented that as "make sure to
use unique tag names", which does not scale beyond apps that know each other.
Parse in Clark notation instead and look extra props up under the namespace
they were registered with. An app can now bring a real namespace URI
({https://app.example/ns}color) or keep the older myapp:color spelling, where
the prefix doubles as the namespace, which is what the server has stored so
far. The two well-known namespaces are stripped back off after parsing, so
Resource.props and prepareFileFromProps keep addressing them by bare name.
Also guard oc:name from being interpreted while a parser context is set up
anyway: a file called "2024.10" was arriving as the number 2024.1.
Needs a webdav release containing the clarkNotationProps option
(perry-mitchell/webdav-client#410).
Registering a prop the old way has to keep working: same request on the wire, same key on extraProps, and it must not collide with the same name in another namespace. Also pins what does change, the parsed props key a custom prop by its namespace now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Custom WebDAV properties were parsed with their namespaces stripped, so two apps using the same property name in different namespaces collapsed onto one key and their values were merged into an array.
registerExtraPropdocumented that as "Make sure to use unique tag names despite differing namespaces", which only works as long as every app knows every other app.Responses are now parsed in Clark notation (
{namespace}name) and extra props are looked up under the namespace they were registered with:The older
myapp:colorspelling keeps working unchanged, there the prefix doubles as the namespace, which is what the server has stored so far.registerExtraPropkeeps its signature, the request goes on the wire exactly as before (xmlns:myapp="myapp",<myapp:color/>), and the value still arrives onextraPropsunder the name it was registered with. Covered by tests.The one thing that does change: the parsed props themselves key a custom prop by its namespace (
{myapp}color) instead of the bare local name. Anything readingextraPropsis unaffected, only code reaching into the raw props for a custom property would need to follow.Notes:
Resource.propsand the WebDAV library'sprepareFileFromPropskeep addressingDAV:andoc:props by their bare name. Nothing outside the extra-prop path changes.ns0,ns1, ...). The server identifies a property by its namespace, not by the prefix.oc:namecarries the file name and was not covered by the WebDAV library's displayname guard, so a file called2024.10arrived as the number2024.1. It gets a parser now, since the parser context had to be set up anyway.Draft: needs a
webdavbump. TheclarkNotationPropsoption is merged upstream (perry-mitchell/webdav-client#410) but unreleased, anddisplaynameTagParserneeds perry-mitchell/webdav-client#415 on top. Until both are released, the branch only builds with a local override:Related Issue
How Has This Been Tested?
packages/web-client/tests/unit/webdav/client/parsers.spec.ts, two apps register the same name in different namespaces, the PROPFIND body asks for both under their own namespace and each app gets its own value backtests/__fixtures__/propfind-custom-namespaces.xml). Both properties were PROPPATCHed onto a real server and read back, the server serialises them with an inline default xmlns2024.10buildResourcekeeps one name in two namespaces apart (functions.spec.ts)Types of changes