using Microsoft.AspNetCore.Mvc; namespace RadicadeServer.CDN; [Route("studiocdn")] public class StudioAssetsCDN : Controller { [HttpGet("unityasset/{filename}"), HttpHead("unityasset/{filename}")] [HttpGet("roomunityasset/{filename}"), HttpHead("roomunityasset/{filename}")] public IActionResult Download(string filename) { if (string.IsNullOrEmpty(filename) || filename.Length > 80 || filename.Any(c => !char.IsAsciiLetterOrDigit(c) && c != '-')) return BadRequest(); var path = Path.GetFullPath(Path.Combine(DBConfig.CDNStorage, filename)); if (!System.IO.File.Exists(path)) return NotFound(); return PhysicalFile(path, "application/octet-stream", enableRangeProcessing: true); } }