Skip to content

Commit

Permalink
Merge pull request #2802 from chlupac/Backslash_fix
Browse files Browse the repository at this point in the history
FileService backslash fix
  • Loading branch information
sbwalker authored May 11, 2023
2 parents 19b560f + 0bec92e commit 36e4a69
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Oqtane.Client/Services/FileService.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -29,9 +30,9 @@ public async Task<List<File>> GetFilesAsync(string folder)

public async Task<List<File>> GetFilesAsync(int siteId, string folderPath)
{
if (!(folderPath.EndsWith(System.IO.Path.DirectorySeparatorChar) || folderPath.EndsWith(System.IO.Path.AltDirectorySeparatorChar)))
if (!(string.IsNullOrEmpty(folderPath) || folderPath.EndsWith(System.IO.Path.DirectorySeparatorChar) || folderPath.EndsWith(System.IO.Path.AltDirectorySeparatorChar)))
{
folderPath = Utilities.PathCombine(folderPath, System.IO.Path.DirectorySeparatorChar.ToString());
folderPath = Utilities.UrlCombine(folderPath) + "/";
}

var path = WebUtility.UrlEncode(folderPath);
Expand Down

0 comments on commit 36e4a69

Please sign in to comment.