Description
I'm trying to connect to a subsonic instance running behind a reverse proxy (at http://subsonic) and on the default port (let's say 127.0.0.1:32768 as an example). It seems that tomahawk's URL generation logic is producing a URL in the config with an extra forwardslash at the end, meaning that the URL is malformed, for example http://subsonic:4040//rest/getIndexes.view?c=tomahawk&f=json&p=redacted&u=duck&v=1.8.0
- note that it has added :4040/
(and yes, I've also got it running on 4040 just incase this was some weird quirk)
Here's a logcat of what happens:
log: subsonic: Subsonic resolver initalized, got credentials from config. user: duck, subsonic_url: http://subsonic:4040/
D log: subsonic: Collection database has been changed. Wiping and re-fetching...
D log: subsonic: Failed to do get request: to: http://subsonic:4040//rest/getIndexes.view?c=tomahawk&f=json&p=redacted&u=duck&v=1.8.0
D log: subsonic: Status Code was: 404
D log: subsonic: Tomahawk.get failed: 404 - Not Found - <!DOCTYPE html><html><head><title>Apache Tomcat/8.0.41 - Error report</title><style type="text/css">H1 {font-
family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;f
ont-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black
;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;col
or:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><body><h1>HTTP Statu
s 404 - </h1><div class="line"></div><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The requested resource is not available.
</u></p><hr class="line"><h3>Apache Tomcat/8.0.41</h3></body></html>
Manually _curl_ing the same request without the extra slash returns valid JSON, so it's fairly obvious that the extra slash needs to go.
It seems this is going to be related to the _sanitizeConfig function in subsonic.js, where it seems the URL is being passed into a library and then spat out with that extra slash, but it's not being handled properly. Could this function be rewritten to not be as trigger-happy to go to port 4040 as well?
Many thanks!