diff options
author | Thomas Amland <thomas.amland@gmail.com> | 2016-01-17 17:46:06 +0100 |
---|---|---|
committer | Martijn Kaijser <mcm.kaijser@gmail.com> | 2016-01-19 22:27:34 +0100 |
commit | f38fc019d2305ba977fea0efa3eb30c5c473ea12 (patch) | |
tree | 3bc6c97f4f04d5202d3eeb1be103810ea932f62d | |
parent | 9d50c197baa8ea86c150e178e69d79ea8c23a3f3 (diff) |
[filesystem] handle resource paths as file paths
fixes incorrect parsing of filenames containing @ characters
-rw-r--r-- | xbmc/URL.cpp | 3 | ||||
-rw-r--r-- | xbmc/filesystem/ResourceFile.cpp | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/xbmc/URL.cpp b/xbmc/URL.cpp index b23080d545..f353a344bd 100644 --- a/xbmc/URL.cpp +++ b/xbmc/URL.cpp @@ -153,7 +153,8 @@ void CURL::Parse(const std::string& strURL1) IsProtocol("virtualpath") || IsProtocol("multipath") || IsProtocol("filereader") || - IsProtocol("special") + IsProtocol("special") || + IsProtocol("resource") ) { SetFileName(strURL.substr(iPos)); diff --git a/xbmc/filesystem/ResourceFile.cpp b/xbmc/filesystem/ResourceFile.cpp index 47f623af3c..8bd5fe0d29 100644 --- a/xbmc/filesystem/ResourceFile.cpp +++ b/xbmc/filesystem/ResourceFile.cpp @@ -49,7 +49,11 @@ bool CResourceFile::TranslatePath(const CURL &url, std::string &translatedPath) return false; // the share name represents an identifier that can be mapped to an addon ID - std::string addonId = url.GetHostName(); + std::string addonId = url.GetShareName(); + std::string filePath; + if (url.GetFileName().length() > addonId.length()) + filePath = url.GetFileName().substr(addonId.size() + 1); + if (addonId.empty()) return false; @@ -61,7 +65,6 @@ bool CResourceFile::TranslatePath(const CURL &url, std::string &translatedPath) if (resource == NULL) return false; - std::string filePath = url.GetFileName(); if (!resource->IsAllowed(filePath)) return false; |