Fixes to HQ download

This commit is contained in:
Rick Falkvinge
2017-12-08 14:43:02 +01:00
parent f50cf601b0
commit 250921bc1f
3 changed files with 12 additions and 9 deletions
+4 -4
View File
@@ -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)
@@ -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;
+5 -4
View File
@@ -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;
}