Extended file manager to support the new interfaces for downloading via url. Improved the handling of compressing and decompressing. Seperated file manager controllers. Updated mooncore versions

This commit is contained in:
2025-08-26 01:07:59 +02:00
parent dc862e4b3c
commit a6ae2aacfb
17 changed files with 868 additions and 503 deletions

View File

@@ -0,0 +1,25 @@
namespace Moonlight.ApiServer.Helpers;
public class FilePathHelper
{
public static string SanitizePath(string path)
{
if (string.IsNullOrWhiteSpace(path))
return string.Empty;
// Normalize separators
path = path.Replace('\\', '/');
// Remove ".." and "."
var parts = path.Split('/', StringSplitOptions.RemoveEmptyEntries)
.Where(part => part != ".." && part != ".");
var sanitized = string.Join("/", parts);
// Ensure it does not start with a slash
if (sanitized.StartsWith('/'))
sanitized = sanitized.TrimStart('/');
return sanitized;
}
}