Skip to content
This repository
Browse code

Merge pull request #2950 from ulion/http_directory_querystring_fix

Fix http directory item detection for items with querystring
  • Loading branch information...
commit a1dd5526b4f49f57854685dfc1833529c465dd87 2 parents 4a9d3a6 + 5958513
ulion authored August 19, 2013

Showing 1 changed file with 16 additions and 3 deletions. Show diff stats Hide diff stats

  1. 19  xbmc/filesystem/HTTPDirectory.cpp
19  xbmc/filesystem/HTTPDirectory.cpp
@@ -92,7 +92,17 @@ bool CHTTPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
92 92
       g_charsetConverter.wToUTF8(wConverted, strNameTemp);
93 93
       URIUtils::RemoveSlashAtEnd(strNameTemp);
94 94
 
95  
-      CStdString strLinkTemp = strLink;
  95
+      CStdString strLinkBase = strLink;
  96
+      CStdString strLinkOptions;
  97
+
  98
+      // split link with url options
  99
+      int pos = strLinkBase.Find('?');
  100
+      if (pos != -1) {
  101
+        strLinkOptions = strLinkBase.Mid(pos);
  102
+        strLinkBase.erase(pos);
  103
+      }
  104
+      CStdString strLinkTemp = strLinkBase;
  105
+
96 106
       URIUtils::RemoveSlashAtEnd(strLinkTemp);
97 107
       CURL::Decode(strLinkTemp);
98 108
       g_charsetConverter.unknownToUTF8(strLinkTemp);
@@ -104,14 +114,17 @@ bool CHTTPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
104 114
           strLinkTemp.Left(strNameTemp.GetLength()-3).Equals(strNameTemp.Left(strNameTemp.GetLength()-3)))
105 115
         strName = strNameTemp = strLinkTemp;
106 116
 
  117
+      // we detect http directory items by its display name and its stripped link
  118
+      // if same, we consider it as a valid item.
107 119
       if (strNameTemp == strLinkTemp && strLinkTemp != "..")
108 120
       {
109 121
         CFileItemPtr pItem(new CFileItem(strNameTemp));
110 122
         pItem->SetProperty("IsHTTPDirectory", true);
111  
-        url.SetFileName(strBasePath + strLink);
  123
+        url.SetFileName(strBasePath + strLinkBase);
  124
+        url.SetOptions(strLinkOptions);
112 125
         pItem->SetPath(url.Get());
113 126
 
114  
-        if(URIUtils::HasSlashAtEnd(pItem->GetPath()))
  127
+        if(URIUtils::HasSlashAtEnd(pItem->GetPath(), true))
115 128
           pItem->m_bIsFolder = true;
116 129
 
117 130
         CStdString day, month, year, hour, minute;

0 notes on commit a1dd552

Please sign in to comment.
Something went wrong with that request. Please try again.