Skip to content

Commit

Permalink
Always treat special paths as local
Browse files Browse the repository at this point in the history
  • Loading branch information
phunkyfish committed Oct 7, 2024
1 parent d7045b2 commit e434561
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/iptvsimple/utilities/WebUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ bool WebUtils::IsNfsUrl(const std::string& url)
return StringUtils::StartsWith(url, NFS_PREFIX);
}

bool WebUtils::IsSpecialUrl(const std::string& url)
{
return StringUtils::StartsWith(url, SPECIAL_PREFIX);
}

std::string WebUtils::RedactUrl(const std::string& url)
{
std::string redactedUrl = url;
Expand All @@ -139,7 +144,7 @@ std::string WebUtils::RedactUrl(const std::string& url)
bool WebUtils::Check(const std::string& strURL, int connectionTimeoutSecs, bool isLocalPath)
{
// For local paths we only need to check existence of the file
if (isLocalPath && FileUtils::FileExists(strURL))
if ((isLocalPath || IsSpecialUrl(strURL)) && FileUtils::FileExists(strURL))
return true;

//Otherwise it's remote
Expand Down
2 changes: 2 additions & 0 deletions src/iptvsimple/utilities/WebUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace iptvsimple
static const std::string HTTP_PREFIX = "http://";
static const std::string HTTPS_PREFIX = "https://";
static const std::string NFS_PREFIX = "nfs://";
static const std::string SPECIAL_PREFIX = "special://";
static const std::string UDP_MULTICAST_PREFIX = "udp://@";
static const std::string RTP_MULTICAST_PREFIX = "rtp://@";

Expand All @@ -28,6 +29,7 @@ namespace iptvsimple
static std::string ReadFileContentsStartOnly(const std::string& url, int* httpCode);
static bool IsHttpUrl(const std::string& url);
static bool IsNfsUrl(const std::string& url);
static bool IsSpecialUrl(const std::string& url);
static std::string RedactUrl(const std::string& url);
static bool Check(const std::string& url, int connectionTimeoutSecs, bool isLocalPath = false);
};
Expand Down

0 comments on commit e434561

Please sign in to comment.