From 1c6b33dcf892b1a297b1b5c2db0df261e5fc661d Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Tue, 21 Jul 2020 09:21:42 +0300 Subject: [PATCH] Fix for missing stream name when no path --- components/streams/src/feed.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/streams/src/feed.cpp b/components/streams/src/feed.cpp index 69ac3c24a..4d19eb542 100644 --- a/components/streams/src/feed.cpp +++ b/components/streams/src/feed.cpp @@ -526,9 +526,11 @@ std::string Feed::getName(const std::string &puri) { auto *cfgble = ftl::config::find(puri); if (cfgble) { auto &j = cfgble->getConfig(); - return (j.is_structured()) ? j.value("name", j.value("uri", uri.getPathSegment(-1))) : uri.getPathSegment(-1); + std::string name = (j.is_structured()) ? j.value("name", j.value("uri", uri.getPathSegment(-1))) : uri.getPathSegment(-1); + return (name.size() == 0) ? uri.getHost() : name; } else { - return uri.getPathSegment(-1); + std::string name = uri.getPathSegment(-1); + return (name.size() == 0) ? uri.getHost() : name; } /*auto n = net_->findOne<std::string>("get_cfg", puri); if (n) { -- GitLab