Skip to content

Commit

Permalink
Fix radio streaming from URL containing no path and no trailing '/'
Browse files Browse the repository at this point in the history
The radio streaming and metadata fetching didn't work for such stream URL
where there was only the domain and possibly a port number but no any kind of
path after that. If there was even the "empty path" denoted with a trailing
slash ('/'), then things worked fine.

As a working example, https://runder.org:8000 is a stream URL where this bug
used to show.
  • Loading branch information
paulijar committed Jan 19, 2025
1 parent 9629236 commit 71215fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Clicking the previously played song didn't play it again after stopping the playback with the keyboard 'stop' media key
- Radio stream relaying not working on some redirecting stream URLs, depending on the headers
[#1194](https://github.com/owncloud/music/issues/1194)
- Radio stream playback failing when the stream URL has only the domain part without any path and no trailing '/' (like http://abc.somedomain.xyz)

## 2.1.1 - 2025-01-03

Expand Down
4 changes: 2 additions & 2 deletions lib/Utility/RadioService.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static function parseStreamUrl(string $url) : array {

$ret['scheme'] = $parse_url['scheme'];
$ret['hostname'] = $parse_url['host'];
$ret['pathname'] = $parse_url['path'];
$ret['pathname'] = $parse_url['path'] ?? '/';

if (isset($parse_url['query'])) {
$ret['pathname'] .= "?" . $parse_url['query'];
Expand Down Expand Up @@ -276,7 +276,7 @@ public function resolveStreamUrl(string $url) : array {
$isHls = false;

$urlParts = \parse_url($url);
$lcPath = \mb_strtolower($urlParts['path']);
$lcPath = \mb_strtolower($urlParts['path'] ?? '/');

$isPls = Util::endsWith($lcPath, '.pls');
$isM3u = !$isPls && (Util::endsWith($lcPath, '.m3u') || Util::endsWith($lcPath, '.m3u8'));
Expand Down

0 comments on commit 71215fb

Please sign in to comment.