Project

General

Profile

Actions

Bug #360

open

HTTP API GetMediaLocation() issue with miniDLNA UPnP server

Added by dandar3 almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Web Server / Web Interface
Target version:
-
Start date:
23/05/2018
Due date:
% Done:

0%

Resolution:
Affected Version:

Description

Issues reported on this forum thread with miniDLNA 1.2.1.
Also replicated by me with miniDLNA 1.0.22 on Seagate GoFlex Home NAS.

HTTP API GetMediaLocation() fails with the following error message:

Error: invalid location, upnp://4d696e69-444c-164e-9d41-0010752d811c/1$4/

and in xbmc.log

22:19:48 M: 36794368   DEBUG: HttpApi Start command: GetMediaLocation  paras: GetMediaLocation; Music;upnp://4d696e69-444c-164e-9d41-0010752d811c/1$4/
22:19:48 M: 36794368 WARNING: CUtil::GetMatchingSource... no matching source found for [upnp://4d696e69-444c-164e-9d41-0010752d811c/1$4/]

This is apparently due to how UPnP URLs are stored internally as URL encoded (/1$4/ is effectively stored in memory as /1%244/) making the resource not able to being identified and matched when GetMediaLocation() function is called. I enabled temporarily some XBMC4Xbox logic showing the problem in the logs:

22:37:15 M: 39821312   DEBUG: HttpApi Start command: GetMediaLocation  paras: GetMediaLocation; Music;upnp://4d696e69-444c-164e-9d41-0010752d811c/1$4/
22:37:15 M: 39821312    INFO: CUtil::GetMatchingSource, testing original path/name [upnp://4d696e69-444c-164e-9d41-0010752d811c/1$4/]
22:37:15 M: 39821312    INFO: CUtil::GetMatchingSource, testing for matching name  [upnp://4d696e69-444c-164e-9d41-0010752d811c/1$4/]
22:37:15 M: 39821312    INFO: CUtil::GetMatchingSource, comparing name [GoFlex Home:UPNP-AV]
22:37:15 M: 39821312   DEBUG: CUtil::GetMatchingSource, testing url   [upnp://4d696e69-444c-164e-9d41-0010752d811c/1$4/]
22:37:15 M: 39821312   DEBUG: CUtil::GetMatchingSource, comparing url [upnp://4d696e69-444c-164e-9d41-0010752d811c/1%244/]
Previous line repeats 1 times.
22:37:15 M: 39821312   DEBUG: CUtil::GetMatchingSource... no matching source found for [upnp://4d696e69-444c-164e-9d41-0010752d811c/1$4/]

Also noticed it is stored URL encoded not only in memory but also in Q:\UserData\sources.xml as well:

    <music>
        ...
        <source>
            <name>GoFlex Home:UPNP-AV</name>
            <path pathversion="1">upnp://4d696e69-444c-164e-9d41-0010752d811c/1%244/</path>
        </source>
    </music>

Temporarily patching CUtil::GetMatchingSource() in Util.cpp just to test things I was able to make it work correctly from the XBMC4XBox web interface.

Index: xbmc/Util.cpp
===================================================================
--- xbmc/Util.cpp    (revision 33032)
+++ xbmc/Util.cpp    (working copy)
@@ -2696,6 +2696,7 @@
       CURL urlShare(vecPaths[j]);
       urlShare.SetOptions("");
       CStdString strShare = urlShare.GetWithoutUserDetails();
+      CURL::Decode(strShare);
       ForceForwardSlashes(strShare);
       if (!URIUtils::HasSlashAtEnd(strShare))
         strShare += "/";

But I think this should probably be best fixed somewhere upstream so that UPnP are always stored URL decoded internally, but not sure where and if any negative implications if changed.

This issue affects both XBMC4XBox web interface and XBMC4XBox Remote (Android).

Any thoughts / pointers are more than welcome.

Thank you,
Dan

No data to display

Actions

Also available in: Atom PDF