From fdc44b4bd9ed4b1c2f858dc6e2a0978cc1a40b85 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 5 Mar 2018 16:27:30 +0100 Subject: [PATCH] Smallfix IX --- .../Support/DownloadUploadedDocument.aspx.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Site/Pages/v5/Support/DownloadUploadedDocument.aspx.cs b/Site/Pages/v5/Support/DownloadUploadedDocument.aspx.cs index 01085d2e..c36e3cfa 100644 --- a/Site/Pages/v5/Support/DownloadUploadedDocument.aspx.cs +++ b/Site/Pages/v5/Support/DownloadUploadedDocument.aspx.cs @@ -21,13 +21,6 @@ namespace Swarmops.Pages.v5.Support string documentDownloadName = Request.QueryString["DocName"]; documentDownloadName = documentDownloadName.Replace("\"", "'"); - if (documentDownloadName.EndsWith(" 2_1")) - { - // Mystery bug - - documentDownloadName = documentDownloadName.Substring(0, documentDownloadName.Length - 4); - } - Document document = Document.FromIdentity (documentId); //Orgid is needed to safely verify permission @@ -214,6 +207,15 @@ namespace Swarmops.Pages.v5.Support } } + if (documentDownloadName.EndsWith(" 2_1") || documentDownloadName.EndsWith(" 2/1")) + { + // Mystery bug + + documentDownloadName = documentDownloadName.Substring(0, documentDownloadName.Length - 4); + } + + + string legacyMarker = string.Empty; if (!File.Exists (Document.StorageRoot + serverFileName)) @@ -237,7 +239,7 @@ namespace Swarmops.Pages.v5.Support } } - Response.ContentType = contentType; + Response.AppendHeader("Content-Type", contentType); Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + documentDownloadName + "\""); Response.TransmitFile (Document.StorageRoot + legacyMarker + serverFileName); }