Merge pull request #4557 from arnova/nginx_filesize
authorTrent Nelson <trent.a.b.nelson@gmail.com>
Wed, 16 Apr 2014 17:47:52 +0000 (11:47 -0600)
committerTrent Nelson <trent.a.b.nelson@gmail.com>
Wed, 16 Apr 2014 22:07:11 +0000 (16:07 -0600)
Nginx filesize was broken for some configs

xbmc/filesystem/HTTPDirectory.cpp

index a40f2ab..85699bd 100644 (file)
@@ -66,7 +66,7 @@ bool CHTTPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
   reSize.RegComp("> *([0-9.]+)(B|K|M|G| )</td>");
 
   CRegExp reSizeNginx(true);
-  reSizeNginx.RegComp("([0-9]+)(B|K|M|G)?$");
+  reSizeNginx.RegComp(" +([0-9]+)(B|K|M|G)?$");
 
   /* read response from server into string buffer */
   char buffer[MAX_PATH + 1024];
@@ -188,7 +188,7 @@ bool CHTTPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
           else if (reSizeNginx.RegFind(strBuffer.c_str()) >= 0)
           {
             double Size = atof(reSizeNginx.GetMatch(1).c_str());
-            std::string strUnit(reSize.GetMatch(2));
+            std::string strUnit(reSizeNginx.GetMatch(2));
 
             if (strUnit == "K")
               Size = Size * 1024;