OS independent file paths

This commit is contained in:
Sean Long
2020-04-17 16:25:00 -04:00
parent 2dd2216aa2
commit 70502cd881
13 changed files with 41 additions and 36 deletions

View File

@ -42,9 +42,9 @@ namespace Oqtane.Services
public async Task<List<File>> GetFilesAsync(int siteId, string folderPath)
{
if (!folderPath.EndsWith("\\"))
if (!(folderPath.EndsWith(System.IO.Path.DirectorySeparatorChar) || folderPath.EndsWith(System.IO.Path.AltDirectorySeparatorChar)))
{
folderPath += "\\";
folderPath = System.IO.Path.Combine(folderPath, " ").TrimEnd(' ');
}
var path = WebUtility.UrlEncode(folderPath);

View File

@ -38,9 +38,9 @@ namespace Oqtane.Services
public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath)
{
if (!folderPath.EndsWith("\\"))
if (!(folderPath.EndsWith(System.IO.Path.DirectorySeparatorChar) || folderPath.EndsWith(System.IO.Path.AltDirectorySeparatorChar)))
{
folderPath += "\\";
folderPath = System.IO.Path.Combine(folderPath, " ").TrimEnd(' ');
}
var path = WebUtility.UrlEncode(folderPath);