diff --git a/HISTORY b/HISTORY index d6030c8..cb603d2 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,7 @@ VDR Plugin 'streamdev' Revision History --------------------------------------- +- Ignore dummy file extensions (.ts, .vob, .vdr) when parsing HTTP URIs - Select start position for replaying a recording by parameter pos=. Supported values are resume, mark.#, time.#, frame.# or a plain # representing a percentage if < 100 or a byte position otherwise (thanks to hivdr) diff --git a/server/connectionHTTP.c b/server/connectionHTTP.c index 02e5170..26f6d1c 100644 --- a/server/connectionHTTP.c +++ b/server/connectionHTTP.c @@ -556,11 +556,24 @@ bool cConnectionHTTP::ProcessURI(const std::string& PathInfo) if (file_pos != std::string::npos) { size_t ext_pos = PathInfo.rfind('.'); - // file basename with leading / stripped off - filespec = PathInfo.substr(file_pos + 1, ext_pos - file_pos - 1); - if (ext_pos != std::string::npos) + if (ext_pos != std::string::npos) { // file extension including leading . fileext = PathInfo.substr(ext_pos); + const char *ext = fileext.c_str(); + // ignore dummy file extensions + if (strcasecmp(ext, ".ts") == 0 || + strcasecmp(ext, ".vdr") == 0 || + strcasecmp(ext, ".vob") == 0) { + size_t ext_end = ext_pos; + if (ext_pos > 0) + ext_pos = PathInfo.rfind('.', ext_pos - 1); + if (ext_pos == std::string::npos) + ext_pos = ext_end; + fileext = PathInfo.substr(ext_pos, ext_end - ext_pos); + } + } + // file basename with leading / stripped off + filespec = PathInfo.substr(file_pos + 1, ext_pos - file_pos - 1); } if (fileext.length() > 5) { //probably not an extension