|
|
|
|
@ -5,6 +5,7 @@ using isnd.Attributes;
|
|
|
|
|
using isnd.Entities;
|
|
|
|
|
using isn.abst;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
|
|
namespace isnd.Controllers
|
|
|
|
|
{
|
|
|
|
|
@ -27,17 +28,18 @@ namespace isnd.Controllers
|
|
|
|
|
return BadRequest("Package does´nt exist in the file system.");
|
|
|
|
|
var pkgVersionDirInfo = pkgDirInfo.GetDirectories().FirstOrDefault(
|
|
|
|
|
s=>s.Name==version);
|
|
|
|
|
if (pkgVersionDirInfo==null)
|
|
|
|
|
return BadRequest("Package does´nt exist in the specified version.");
|
|
|
|
|
|
|
|
|
|
var pkgNameSpec=$"{id}-{version}.{Constants.PacketFileExtension}";
|
|
|
|
|
|
|
|
|
|
if (pkgVersionDirInfo == null)
|
|
|
|
|
return NotFound();
|
|
|
|
|
|
|
|
|
|
FileInfo pkgFileInfo = pkgVersionDirInfo.GetFiles()
|
|
|
|
|
.FirstOrDefault(p=>string.Compare(p.Name,pkgNameSpec,
|
|
|
|
|
System.StringComparison.InvariantCultureIgnoreCase)==0);
|
|
|
|
|
|
|
|
|
|
if (!pkgFileInfo.Exists)
|
|
|
|
|
if (pkgFileInfo==null || !pkgFileInfo.Exists)
|
|
|
|
|
{
|
|
|
|
|
logger.LogError($"Not found in {pkgVersionDirInfo.FullName} : {pkgNameSpec}");
|
|
|
|
|
return BadRequest("Package version does´nt exist in the file system.");
|
|
|
|
|
}
|
|
|
|
|
return File(pkgFileInfo.OpenRead(), "application/zip; charset=binary");
|
|
|
|
|
|