GNOME Bugzilla – Bug 705564
7.3.63.6: browse/search result should have no dlna namespace if not present in filter args
Last modified: 2019-02-22 05:58:06 UTC
DLNA 7.3.63.6 guidlines states that dlna namespace must be declared only when the Filter args request for one or more dlna attributes or elements. Tried to make a change in gupnp-av lib : apply_filter method in gupnp-didl-lite-writer.c, but I could not find a clean way to do that. So added logic in Rygel to remove the dlna namespace after checking the filter args before sending browse/search response.
Created attachment 250966 [details] [review] Removing dlna namespace when requested in filter args
Update : Attachment comment - "Removing dlna namespace when not requested in filter args"
Created attachment 250969 [details] [review] Removing dlna namespace when not requested in filter args Removed extra lines added in previous patch
Hm, I think the "correct" solution would be that gupnp-av only adds the namespaces if it's going to add a node or attribute from that namespace.
Created attachment 254015 [details] [review] Add dlna namespace only when requested in filter args
@Jens : Should I create a separate gupnp-av bug for this?
@Jens : One more comment on the new patch. This patch must go after the patch included in bug 706928.
No need, I can just move this one
Review of attachment 254015 [details] [review]: Seems to have several indenting issues, otherwise fine ::: libgupnp-av/gupnp-didl-lite-writer.c @@ +217,3 @@ + for (attr = node->properties; attr != NULL; attr = attr->next) { + if (attr->ns && g_strcmp0 (attr->ns->prefix, "dlna") == 0) { + xmlAttr *attr; Indenting issue @@ +300,3 @@ g_return_if_fail (filter != NULL); + if (filter[0] == '*') { Indenting issue @@ +319,3 @@ + if (writer->priv->dlna_attr_present) { + xmlNewNs (writer->priv->xml_node, Indenting issue
*** Bug 702556 has been marked as a duplicate of this bug. ***
Pushed with minor style adjustments
This change breaks the DIDL-Lite XML created with GUPnPDIDLLiteWriter if the gupnp_didl_writer_filter() method is not being used. If the output is not filtered (which is as fas as I can see a perfectly valid use-case), then the DLNA namespace declaration will be missing even though you used for example gupnp_didl_lite_object_set_album_art() which adds an attriute that uses the dlna: namespace. IMO a better fix should be found that makes sure that namespace declarations are added at the point when they are used. This would also ensure that namespaces which are likely to be unused such as the recently added pv namespace would not be added by default. If you agree, then please reopen this ticket or, if you prefer, I can open a new one.
meh.
https://git.gnome.org/browse/gupnp-av/log/?h=wip/lazy-namespaces This doesn't take into account removing of the final "thing" in a namespace yet
Created attachment 267780 [details] [review] Add utility functions for ns creation
Created attachment 267781 [details] [review] Add utility function to find namespaces
Created attachment 267782 [details] [review] Add utility function to lazy-create ns
Created attachment 267783 [details] [review] Lazy-create XML namespaces
Created attachment 267784 [details] [review] Revert "Add dlna namespace only when it's actually used" This reverts commit 50a5e45591e7bccb79250502c22233793dc6b2cb. Conflicts: libgupnp-av/gupnp-didl-lite-writer.c
Created attachment 267785 [details] [review] Add testcase for bgo705564#c12 Signed-off-by: Jens Georg <mail@jensge.org>
Attachment 267780 [details] pushed as fcd094d - Add utility functions for ns creation Attachment 267781 [details] pushed as 9b4e5e8 - Add utility function to find namespaces Attachment 267782 [details] pushed as 655de6e - Add utility function to lazy-create ns Attachment 267783 [details] pushed as 456a9ce - Lazy-create XML namespaces Attachment 267784 [details] pushed as 556c9a2 - Revert "Add dlna namespace only when it's actually used"