diff options
author | fuzzard <fuzzard@users.noreply.github.com> | 2023-10-17 11:13:48 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-17 11:13:48 +1000 |
commit | 9cd442783a2cf0fb48cbb6dbdf0474868333dd34 (patch) | |
tree | fc085155c8441bc93721bc01e9af42ceb2a2efc5 | |
parent | dddc580d34846931f006a50209414c7544975cb3 (diff) | |
parent | 8b669e3abc6673ccf2b5d401e18259e321d9340b (diff) |
Merge pull request #23711 from CrystalP/fix-upnp-auth-source
[uPnP] Fix playback of files accessed with curl (ftp, http, ...)
-rw-r--r-- | xbmc/filesystem/NptXbmcFile.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/xbmc/filesystem/NptXbmcFile.cpp b/xbmc/filesystem/NptXbmcFile.cpp index 90252ba0b4..aba25873dc 100644 --- a/xbmc/filesystem/NptXbmcFile.cpp +++ b/xbmc/filesystem/NptXbmcFile.cpp @@ -13,7 +13,9 @@ +---------------------------------------------------------------------*/ #include "File.h" #include "FileFactory.h" +#include "PasswordManager.h" #include "URL.h" +#include "utils/URIUtils.h" #include <limits> @@ -294,16 +296,17 @@ NPT_XbmcFile::Open(NPT_File::OpenMode mode) } bool result; - CURL* url = new CURL(name); + CURL url(URIUtils::SubstitutePath(name)); + + if (CPasswordManager::GetInstance().IsURLSupported(url) && url.GetUserName().empty()) + CPasswordManager::GetInstance().AuthenticateURL(url); // compute mode - if (mode & NPT_FILE_OPEN_MODE_WRITE) { - result = file->OpenForWrite(*url, (mode & NPT_FILE_OPEN_MODE_TRUNCATE)?true:false); - } else { - result = file->Open(*url); - } + if (mode & NPT_FILE_OPEN_MODE_WRITE) + result = file->OpenForWrite(url, (mode & NPT_FILE_OPEN_MODE_TRUNCATE) ? true : false); + else + result = file->Open(url); - delete url; if (!result) return NPT_ERROR_NO_SUCH_FILE; } |