From 250921bc1fb8a1c593ed2f11b909b1dc263b57a5 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Fri, 8 Dec 2017 14:43:02 +0100 Subject: [PATCH] Fixes to HQ download --- Database/Database-Expenses.cs | 8 ++++---- .../BackendServices/RasterizeDocumentHiresOrder.cs | 4 +++- Site/Pages/v5/Support/StreamUpload.aspx.cs | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Database/Database-Expenses.cs b/Database/Database-Expenses.cs index 0df85435..82971387 100644 --- a/Database/Database-Expenses.cs +++ b/Database/Database-Expenses.cs @@ -11,10 +11,10 @@ namespace Swarmops.Database public partial class SwarmDb { private string expenseClaimFieldSequence = - " ExpenseClaimId,ClaimingPersonId,CreatedDateTime,Open,Attested," + - " Validated,Claimed,OrganizationId,GeographyId,BudgetId," + - " ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid,KeepSeparate, " + - " VatCents, OrganizationSequenceId " + + " ExpenseClaimId,ClaimingPersonId,CreatedDateTime,Open,Attested," + // 0-4 + " Validated,Claimed,OrganizationId,GeographyId,BudgetId," + // 5-9 + " ExpenseDate,Description,PreApprovedAmount,AmountCents,Repaid," + // 10-14 + " KeepSeparate,VatCents,OrganizationSequenceId " + // 15-17 " FROM ExpenseClaims"; public BasicExpenseClaim GetExpenseClaim (int expenseClaimId) diff --git a/Logic/Support/BackendServices/RasterizeDocumentHiresOrder.cs b/Logic/Support/BackendServices/RasterizeDocumentHiresOrder.cs index 1108c377..1eea4782 100644 --- a/Logic/Support/BackendServices/RasterizeDocumentHiresOrder.cs +++ b/Logic/Support/BackendServices/RasterizeDocumentHiresOrder.cs @@ -30,6 +30,7 @@ namespace Swarmops.Logic.Support.BackendServices private static void LongRun(object orderObject) { + Console.WriteLine(" * LongRun running"); RasterizeDocumentHiresOrder order = (RasterizeDocumentHiresOrder) orderObject; Document document = Document.FromIdentity(order.DocumentId); try @@ -38,7 +39,8 @@ namespace Swarmops.Logic.Support.BackendServices } catch (Exception exception) { - order.ThrewException(exception); + Console.WriteLine(" * Exception: " + exception.ToString()); + order.ThrewException(exception); } order.Close(); order.HasTerminated = true; diff --git a/Site/Pages/v5/Support/StreamUpload.aspx.cs b/Site/Pages/v5/Support/StreamUpload.aspx.cs index d7733fe5..c7cf4f6d 100644 --- a/Site/Pages/v5/Support/StreamUpload.aspx.cs +++ b/Site/Pages/v5/Support/StreamUpload.aspx.cs @@ -174,13 +174,14 @@ namespace Swarmops.Pages.v5.Support string contentType = string.Empty; - string fileNameLower = document.ClientFileName.ToLowerInvariant(); + string clientFileNameLower = document.ClientFileName.ToLowerInvariant().Trim(); + string serverFileNameLower = document.ServerFileName.ToLowerInvariant().Trim(); - if (fileNameLower.EndsWith (".pdf")) + if (clientFileNameLower.EndsWith (".pdf")) { contentType = MediaTypeNames.Application.Pdf; } - else if (fileNameLower.EndsWith (".png")) + else if (clientFileNameLower == (".png") || serverFileNameLower.EndsWith (".png")) // native PNG or converted PDF { contentType = "image/png"; // why isn't this in MediaTypeNames? if (Request.QueryString["hq"] == "1") @@ -192,7 +193,7 @@ namespace Swarmops.Pages.v5.Support } } } - else if (fileNameLower.EndsWith (".jpg")) + else if (clientFileNameLower.EndsWith (".jpg") || clientFileNameLower.EndsWith(".jpeg")) { contentType = MediaTypeNames.Image.Jpeg; }