mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-05 20:54:31 +13:00
Merge branch 'master' of github.com:ShareX/ShareX
This commit is contained in:
commit
aefafc84de
3 changed files with 6 additions and 7 deletions
|
@ -43,6 +43,7 @@ You should have received a copy of the GNU General Public License
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Web;
|
||||
|
||||
namespace ShareX.HelpersLib
|
||||
{
|
||||
|
@ -215,7 +216,7 @@ public static string GetValidFilePath(string filePath)
|
|||
public static string GetValidURL(string url, bool replaceSpace = false)
|
||||
{
|
||||
if (replaceSpace) url = url.Replace(' ', '_');
|
||||
return new string(url.Where(c => ValidURLCharacters.Contains(c)).ToArray());
|
||||
return HttpUtility.UrlPathEncode(url);
|
||||
}
|
||||
|
||||
public static string GetXMLValue(string input, string tag)
|
||||
|
|
|
@ -110,7 +110,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
UploadResult result = new UploadResult();
|
||||
|
||||
fileName = Helpers.GetValidURL(fileName);
|
||||
string subFolderPath = Account.GetSubFolderPath();
|
||||
string subFolderPath = Account.GetSubFolderPath(null, NameParserType.FolderPath);
|
||||
string path = subFolderPath.CombineURL(fileName);
|
||||
bool uploadResult;
|
||||
|
||||
|
|
|
@ -138,9 +138,9 @@ public FTPAccount()
|
|||
FTPSCertificateLocation = string.Empty;
|
||||
}
|
||||
|
||||
public string GetSubFolderPath(string filename = null)
|
||||
public string GetSubFolderPath(string filename = null, NameParserType nameParserType = NameParserType.URL)
|
||||
{
|
||||
string path = NameParser.Parse(NameParserType.URL, SubFolderPath.Replace("%host", Host));
|
||||
string path = NameParser.Parse(nameParserType, SubFolderPath.Replace("%host", Host));
|
||||
return URLHelpers.CombineURL(path, filename);
|
||||
}
|
||||
|
||||
|
@ -175,8 +175,6 @@ public string GetUriPath(string filename, string subFolderPath = null)
|
|||
subFolderPath = GetSubFolderPath();
|
||||
}
|
||||
|
||||
subFolderPath = URLHelpers.URLPathEncode(subFolderPath);
|
||||
|
||||
UriBuilder httpHomeUri;
|
||||
var httpHomePath = GetHttpHomePath();
|
||||
|
||||
|
@ -242,7 +240,7 @@ public string GetFtpPath(string filemame)
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
return URLHelpers.CombineURL(FTPAddress, GetSubFolderPath(filemame));
|
||||
return URLHelpers.CombineURL(FTPAddress, GetSubFolderPath(filemame, NameParserType.FolderPath));
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
Loading…
Reference in a new issue