Пример #1
0
        public async Task <IActionResult> CheckBuildFile([FromRoute] string orgSlug, [FromRoute] string dsSlug,
                                                         [FromRoute] string hash, [FromRoute] string path)
        {
            try
            {
                _logger.LogDebug("Objects controller CheckBuildFile('{OrgSlug}', '{DsSlug}', '{Path}')", orgSlug,
                                 dsSlug, path);

                var res = await _objectsManager.CheckBuildFile(orgSlug, dsSlug, hash, path);

                return(res ? Ok() : NotFound());
            }
            catch (UnauthorizedException ex)
            {
                BasicAuthFilter.SendBasicAuthRequest(Response);
                return(ExceptionResult(ex));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex,
                                 "Exception in Objects controller CheckBuildFile('{OrgSlug}', '{DsSlug}', '{Path}')", orgSlug,
                                 dsSlug, path);

                return(ExceptionResult(ex));
            }
        }
Пример #2
0
        public async Task <IActionResult> BuildFile([FromRoute] string orgSlug, [FromRoute] string dsSlug, [FromRoute] string hash, [FromRoute] string path)
        {
            try
            {
                _logger.LogDebug("Objects controller BuildFile('{OrgSlug}', '{DsSlug}', '{Path}')", orgSlug, dsSlug, path);

                var res = await _objectsManager.GetBuildFile(orgSlug, dsSlug, hash, path);

                return(PhysicalFile(res, MimeUtility.GetMimeMapping(res), true));
            }
            catch (UnauthorizedException ex) {
                BasicAuthFilter.SendBasicAuthRequest(Response);
                return(ExceptionResult(ex));
            }
            catch (Exception ex)
            {
                return(ExceptionResult(ex));
            }
        }