fix #1197 - move folder path logic from Client Service to Server Controller
This commit is contained in:
@ -35,13 +35,7 @@ namespace Oqtane.Services
|
|||||||
|
|
||||||
public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath)
|
public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath)
|
||||||
{
|
{
|
||||||
if (!(folderPath.EndsWith(System.IO.Path.DirectorySeparatorChar) || folderPath.EndsWith(System.IO.Path.AltDirectorySeparatorChar)))
|
|
||||||
{
|
|
||||||
folderPath = Utilities.PathCombine(folderPath, System.IO.Path.DirectorySeparatorChar.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = WebUtility.UrlEncode(folderPath);
|
var path = WebUtility.UrlEncode(folderPath);
|
||||||
|
|
||||||
return await GetJsonAsync<Folder>($"{ApiUrl}/{siteId}/{path}");
|
return await GetJsonAsync<Folder>($"{ApiUrl}/{siteId}/{path}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@ -69,6 +69,10 @@ namespace Oqtane.Controllers
|
|||||||
public Folder GetByPath(int siteId, string path)
|
public Folder GetByPath(int siteId, string path)
|
||||||
{
|
{
|
||||||
var folderPath = WebUtility.UrlDecode(path);
|
var folderPath = WebUtility.UrlDecode(path);
|
||||||
|
if (!(folderPath.EndsWith(System.IO.Path.DirectorySeparatorChar) || folderPath.EndsWith(System.IO.Path.AltDirectorySeparatorChar)))
|
||||||
|
{
|
||||||
|
folderPath = Utilities.PathCombine(folderPath, System.IO.Path.DirectorySeparatorChar.ToString());
|
||||||
|
}
|
||||||
Folder folder = _folders.GetFolder(siteId, folderPath);
|
Folder folder = _folders.GetFolder(siteId, folderPath);
|
||||||
if (folder != null)
|
if (folder != null)
|
||||||
if (_userPermissions.IsAuthorized(User, PermissionNames.Browse, folder.Permissions))
|
if (_userPermissions.IsAuthorized(User, PermissionNames.Browse, folder.Permissions))
|
||||||
|
Reference in New Issue
Block a user