GNOME Bugzilla – Bug 705522
Validating mandatory tags for non empty literal value
Last modified: 2019-02-22 05:58:02 UTC
Check must be done for checking if the mandatory tags(dc:title, dc:class) are not being set to an empty literal while performing UpdateObject.
Created attachment 250891 [details] Validating non empty literal value
Created attachment 250892 [details] [review] Validating non empty literal value Updated Fixed Whitespaces
Any comments on this patch ?
Review of attachment 250892 [details] [review]: ok
Review of attachment 250892 [details] [review]: Sorry, while trying to apply and fix the style issues I actually had some more comments on this. ::: libgupnp-av/fragment-util.c @@ +711,3 @@ } + // If the child element is title or class it must not be set to empty or removed. No C++/C90 style comments, please. @@ +712,3 @@ + // If the child element is title or class it must not be set to empty or removed. + if (current_doc->children->children != NULL) { Can we safely assume that current_doc->children is non-NULL here? @@ +714,3 @@ + if (current_doc->children->children != NULL) { + if (g_strrstr(current_doc->children->children->name,"title") != NULL + || g_strrstr(current_doc->children->children->name,"class") != NULL){ || on previous line, also missing " " before (, { and " and the whole line is too long.
Will work on it and update a new patch soon.
Review of attachment 250892 [details] [review]: ::: libgupnp-av/fragment-util.c @@ +711,3 @@ } + // If the child element is title or class it must not be set to empty or removed. Done @@ +712,3 @@ + // If the child element is title or class it must not be set to empty or removed. + if (current_doc->children->children != NULL) { There were instances where has been NULL(negative scenarios where we need to return validation error). Thats why added this check. @@ +714,3 @@ + if (current_doc->children->children != NULL) { + if (g_strrstr(current_doc->children->children->name,"title") != NULL + || g_strrstr(current_doc->children->children->name,"class") != NULL){ Done. Attaching the new patch..
Created attachment 263690 [details] [review] Updated Patch for checking empty madatory tags
Addressed all the review comments. Hope I did not miss anything else.
@Jens : Does this look better?
The patch still assumes that doc->children is non-NULL. Is that the case? If so, we should comment that.
Yes tried various scenarios, did not encounter where doc->children is NULL. I will add a comment to place the assumption.
Created attachment 267655 [details] [review] Check for mandatory tags - Assumptions added
New patch added. Add the doc->children is non-NULL assumption as a comment.
Review of attachment 267655 [details] [review]: k
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.