Bug 17525 - No CLI response for items with coderefs
: No CLI response for items with coderefs
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: CLI
: 7.6.0
: PC Other
: -- normal (vote)
: ---
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-31 12:32 UTC by Adrian Smith
Modified: 2011-09-02 11:22 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Smith 2011-08-31 12:32:55 UTC
Json clients using non menu mode get no response for menu items with coderefs as urls as json serialisation breaks.  This is common with the new browse menu interface and plugins which do this.  Seen by iPeng with plugins, but its a general case and there is no value in sending coderefs in the response, so they should be screened out.

Propose:
--- Slim/Control/XMLBrowser.pm  (revision 33279)
+++ Slim/Control/XMLBrowser.pm  (working copy)
@@ -1326,9 +1326,13 @@
                                                $hash{name}  = $name          if defined $name;
                                                $hash{type}  = $item->{type}  if defined $item->{type};
                                                $hash{title} = $item->{title} if defined $item->{title};
-                                               $hash{url}   = $item->{url}   if $want_url && defined $item->{url};
                                                $hash{image} = $item->{image} if defined $item->{image};
-
+
+                                               # add url entries if requested unless they are coderefs as this breaks serialisation
+                                               if ($want_url && defined $item->{url} && (!ref $item->{url} || ref $item->{url} ne 'CODE')) {
+                                                       $hash{url} = $item->{url};
+                                               }
+
                                                $hash{isaudio} = defined(hasAudio($item)) + 0;
 
                                                # Bug 7684, set hasitems to 1 if any of the following are true:
Comment 1 Adrian Smith 2011-08-31 12:34:42 UTC
Michael - do you agree?
Comment 2 Michael Herger 2011-09-01 02:16:08 UTC
Makes sense.
Comment 3 SVN Bot 2011-09-02 11:21:43 UTC
 == Auto-comment from SVN commit #33302 to the slim repo by adrian ==
 == http://svn.slimdevices.com/slim?view=revision&revision=33302 ==

Bug: 17525
Description: avoid including coderef urls when what_url is requested for non menumode as it breaks serialisation resulting in no json response.