Skip to content

Commit b67ea33

Browse files
BUG:12797 - 0 byte/kb file not allowed.
1 parent 122b7b3 commit b67ea33

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

App/backend-api/Microsoft.GS.DPS.Host/API/KernelMemory/KernelMemory.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ DPS.API.KernelMemory kernelMemory
4949
Summary = $"{fileExtension} file is Unsupported file type" });
5050
}
5151

52+
// Checking File Size: O byte/kb file not allowed
53+
if (file == null || file.Length == 0)
54+
{
55+
return Results.BadRequest(new DocumentImportedResult()
56+
{
57+
DocumentId = string.Empty,
58+
MimeType = contentType,
59+
Summary = "The file is empty and cannot be uploaded. Please select a valid file."
60+
});
61+
}
62+
5263
var result = await kernelMemory.ImportDocument(fileStream, file.FileName, contentType);
5364

5465
//Return HTTP 202 with Location Header

0 commit comments

Comments
 (0)