feature: display pdf attachments inline

This commit is contained in:
Gary Sharp
2026-01-26 16:34:26 +11:00
parent f807d75162
commit 204d57a4a5
15 changed files with 6285 additions and 274 deletions
@@ -547,7 +547,7 @@ namespace Disco.Web.Areas.API.Controllers
#region Device Attachments
[DiscoAuthorize(Claims.Device.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id)
public virtual ActionResult AttachmentDownload(int id, bool? inline = null)
{
var da = Database.DeviceAttachments.Find(id);
if (da != null)
@@ -555,7 +555,7 @@ namespace Disco.Web.Areas.API.Controllers
var filePath = da.RepositoryFilename(Database);
if (System.IO.File.Exists(filePath))
{
return File(filePath, da.MimeType, da.Filename);
return File(filePath, da.MimeType, (inline ?? false) ? null : da.Filename);
}
else
{
@@ -1927,7 +1927,7 @@ namespace Disco.Web.Areas.API.Controllers
#region Job Attachments
[DiscoAuthorize(Claims.Job.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id)
public virtual ActionResult AttachmentDownload(int id, bool? inline = null)
{
var ja = Database.JobAttachments.Find(id);
if (ja != null)
@@ -1935,7 +1935,7 @@ namespace Disco.Web.Areas.API.Controllers
var filePath = ja.RepositoryFilename(Database);
if (System.IO.File.Exists(filePath))
{
return File(filePath, ja.MimeType, ja.Filename);
return File(filePath, ja.MimeType, (inline ?? false) ? null : ja.Filename);
}
else
{
@@ -108,7 +108,7 @@ namespace Disco.Web.Areas.API.Controllers
[DiscoAuthorize(Claims.User.ShowAttachments)]
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id)
public virtual ActionResult AttachmentDownload(int id, bool? inline = null)
{
var ua = Database.UserAttachments.Find(id);
if (ua != null)
@@ -116,7 +116,7 @@ namespace Disco.Web.Areas.API.Controllers
var filePath = ua.RepositoryFilename(Database);
if (System.IO.File.Exists(filePath))
{
return File(filePath, ua.MimeType, ua.Filename);
return File(filePath, ua.MimeType, (inline ?? false) ? null : ua.Filename);
}
else
{