Merge pull request #3190 from sbwalker/dev

resolve #3189 - make path a querystring parameter
This commit is contained in:
Shaun Walker 2023-08-25 09:49:22 -04:00 committed by GitHub
commit d4daf098e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -29,7 +29,7 @@ namespace Oqtane.Services
public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath) public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath)
{ {
var path = WebUtility.UrlEncode(folderPath); var path = WebUtility.UrlEncode(folderPath);
return await GetJsonAsync<Folder>($"{ApiUrl}/{siteId}/{path}"); return await GetJsonAsync<Folder>($"{ApiUrl}/path/{siteId}/?path={path}");
} }
public async Task<Folder> AddFolderAsync(Folder folder) public async Task<Folder> AddFolderAsync(Folder folder)

View File

@ -84,10 +84,11 @@ namespace Oqtane.Controllers
} }
} }
[HttpGet("{siteId}/{path}")] // GET api/<controller>/path/x/?path=y
[HttpGet("path/{siteId}")]
public Folder GetByPath(int siteId, string path) public Folder GetByPath(int siteId, string path)
{ {
var folderPath = WebUtility.UrlDecode(path).Replace("\\", "/"); var folderPath = WebUtility.UrlDecode(path).Replace("\\", "/"); // handle legacy path format
folderPath = (folderPath == "/") ? "" : folderPath; folderPath = (folderPath == "/") ? "" : folderPath;
if (!folderPath.EndsWith("/") && folderPath != "") if (!folderPath.EndsWith("/") && folderPath != "")
{ {

View File

@ -97,7 +97,7 @@ namespace Oqtane.Models
[NotMapped] [NotMapped]
public string FolderPath public string FolderPath
{ {
get => "Users\\" + UserId.ToString() + "\\"; get => "Users/" + UserId.ToString() + "/";
} }
/// <summary> /// <summary>