Skip to content

Commit

Permalink
FIX: Download file doesn't work if blob member is not specified. (#2427)
Browse files Browse the repository at this point in the history
* Download file doesn't work if blob member is not specified.
* Variable name processBlobField -> blobMemberAvailable
* Refactoring.
  • Loading branch information
washibana committed Jan 25, 2024
1 parent 335311a commit dce4109
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions backend/Origam.Server/Controller/BlobController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

using System;
using System.ComponentModel.DataAnnotations;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Security.Principal;
Expand All @@ -34,7 +33,6 @@
using Microsoft.Net.Http.Headers;
using Origam.DA;
using Origam.Schema;
using Origam.Server;
using Origam.Workbench.Services;
using ImageMagick;
using Origam.Server.Model.Blob;
Expand All @@ -47,11 +45,11 @@ namespace Origam.Server.Controller
public class BlobController : AbstractController
{
private readonly IStringLocalizer<SharedResources> localizer;
private readonly CoreHttpTools httpTools = new CoreHttpTools();
private readonly CoreHttpTools httpTools = new();
public BlobController(
SessionObjects sessionObjects,
IStringLocalizer<SharedResources> localizer,
ILogger<AbstractController> log) : base(log, sessionObjects)
ILogger<BlobController> log) : base(log, sessionObjects)
{
this.localizer = localizer;
}
Expand Down Expand Up @@ -93,12 +91,12 @@ public IActionResult Get(Guid token)
}
Stream resultStream;
MemoryStream memoryStream;
var processBlobField
= string.IsNullOrEmpty(blobDownloadRequest.BlobMember)
var blobMemberAvailable
= !string.IsNullOrEmpty(blobDownloadRequest.BlobMember)
&& (blobDownloadRequest.Row[
blobDownloadRequest.BlobMember] != DBNull.Value);
if((blobDownloadRequest.BlobLookupId != Guid.Empty)
&& !processBlobField)
&& !blobMemberAvailable)
{
var lookupService = ServiceManager.Services
.GetService<IDataLookupService>();
Expand Down Expand Up @@ -132,7 +130,7 @@ var processBlobField
}
else
{
if(blobDownloadRequest.Row[blobDownloadRequest.BlobMember]
if(blobDownloadRequest.Row[blobDownloadRequest.BlobMember!]
== DBNull.Value)
{
return BadRequest(localizer["ErrorBlobRecordEmpty"]
Expand Down

0 comments on commit dce4109

Please sign in to comment.