Skip to content

Commit

Permalink
Implement similar 0bytes logic in localtest as in altinn-storage (#54)
Browse files Browse the repository at this point in the history
* Implement similar logic in app-localtest as in storage to resolve Altinn/altinn-storage#253

* Match respons body with actual storages messagebody
  • Loading branch information
tjololo authored Dec 12, 2023
1 parent 2200dd5 commit 3cfd11c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Controllers/Storage/DataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ public async Task<ActionResult<DataElement>> CreateAndUploadData(
newData.Filename = HttpUtility.UrlDecode(newData.Filename);
(long length, DateTimeOffset blobTimestamp) = await _dataRepository.WriteDataToStorage(instance.Org, theStream, newData.BlobStoragePath);
newData.Size = length;
if (length == 0)
{
await _dataRepository.DeleteDataInStorage(instance.Org, newData.BlobStoragePath);
return BadRequest("Empty stream provided. Cannot persist data.");
}

if (User.GetOrg() == instance.Org)
{
Expand Down

0 comments on commit 3cfd11c

Please sign in to comment.