GetFileName fix for DownloadAndUpload

This commit is contained in:
Jaex 2015-08-28 12:34:54 +03:00
parent 1e07597bc4
commit 82ac01f3fe
2 changed files with 6 additions and 6 deletions

View file

@ -251,7 +251,7 @@ public static string AddSlash(string url, SlashType slashType, int count)
return url;
}
public static string GetFileName(string path, bool checkExtension = false, bool urlDecode = false)
public static string GetFileName(string path, bool urlDecode = false)
{
if (urlDecode)
{
@ -264,14 +264,14 @@ public static string GetFileName(string path, bool checkExtension = false, bool
}
}
if (path.Contains("/"))
if (path.Contains('/'))
{
path = path.Remove(0, path.LastIndexOf('/') + 1);
path = path.Substring(path.LastIndexOf('/') + 1);
}
if (checkExtension && !Path.HasExtension(path))
if (path.Contains('?'))
{
return null;
path = path.Remove(path.IndexOf('?'));
}
return path;

View file

@ -1283,7 +1283,7 @@ private bool DownloadAndUpload()
{
string url = Info.Result.URL.Trim();
Info.Result.URL = string.Empty;
string filename = URLHelpers.GetFileName(url, true, true);
string filename = URLHelpers.GetFileName(url, true); // TODO: Set filename in task creation
if (!string.IsNullOrEmpty(filename))
{