Updater: Improve filename cache
@@ -486,13 +486,18 @@ static PPH_STRING UpdaterParseDownloadFileName(
_In_ PPH_STRING DownloadUrlPath
)
{
+ static PH_STRINGREF seperator = PH_STRINGREF_INIT(L"="); // download=
PH_STRINGREF pathPart;
PH_STRINGREF baseNamePart;
PPH_STRING filePath;
PPH_STRING downloadFileName;
- if (!PhSplitStringRefAtLastChar(&DownloadUrlPath->sr, '/', &pathPart, &baseNamePart))
- return NULL;
+ if (PhSplitStringRefAtLastChar(&DownloadUrlPath->sr, L'/', &pathPart, &baseNamePart))
+ {
+ if (PhFindStringInStringRef(&DownloadUrlPath->sr, &seperator, TRUE) != -1)
+ {
+ PhSplitStringRefAtString(&DownloadUrlPath->sr, &seperator, TRUE, &pathPart, &baseNamePart);
+ }
downloadFileName = PhCreateString2(&baseNamePart);
filePath = PhCreateCacheFile(downloadFileName);
@@ -501,6 +506,9 @@ static PPH_STRING UpdaterParseDownloadFileName(
return filePath;
}
+ return NULL;
+}
+
NTSTATUS UpdateDownloadThread(
_In_ PVOID Parameter
)
