Skip to content

Commit fdc653e

Browse files
closes #6 Upload attachments if the extensions whitelist is empty
1 parent 433d873 commit fdc653e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Scr/Sdk4me.GraphQL/Sdk4meClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public async Task<AttachmentUploadResponse> UploadAttachment(Stream stream, stri
346346
if (attachmentStorages.FirstOrDefault() is AttachmentStorage attachmentStorage)
347347
{
348348
string fileExtension = Path.GetExtension(fileName).TrimStart('.');
349-
if (attachmentStorage.AllowedExtensions != null && attachmentStorage.AllowedExtensions.Contains(fileExtension, StringComparer.InvariantCultureIgnoreCase))
349+
if (attachmentStorage.AllowedExtensions != null && (!attachmentStorage.AllowedExtensions.Any() || attachmentStorage.AllowedExtensions.Contains(fileExtension, StringComparer.InvariantCultureIgnoreCase)))
350350
{
351351
if (stream.Length >= attachmentStorage.SizeLimit)
352352
throw new Sdk4meException($"File size exceeded, the maximum size is {attachmentStorage.SizeLimit} byte");

0 commit comments

Comments
 (0)