예제 #1
0
        public async Task <IActionResult> DownloadFileSplash(FileIdentifier id)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest());
            }

            UploadedFile uploadedFile = await this._uploadedFileRepository.GetFile(id);

            if (uploadedFile == null)
            {
                this._logger.LogWarning(LogEvents.UploadNotFound, "Unable to find uploaded file for download '{0}'", id);

                this.Response.StatusCode = 404;
                return(this.View("NotFound"));
            }

            if (DirectDownloadClientDetector.IsDirectDownloadClient(this.Request.Headers["User-Agent"].ToString()))
            {
                return(this.RedirectToRoute("DownloadFileRaw"));
            }

            return(this.View(uploadedFile));
        }
예제 #2
0
 private bool IsDirectDownloadClient()
 {
     return(DirectDownloadClientDetector.IsDirectDownloadClient(this.Request.Headers["User-Agent"].ToString()));
 }