Exemple #1
0
        private async Task <bool> IsZipFile(IFormFile file)
        {
            if (!file.FileName.ToLower().EndsWith(".zip"))
            {
                return(false);
            }

            return(await _fileTypeService.HasMatchingMimeType(
                       file,
                       AllowedMimeTypesByFileType[DataZip]
                       ) &&
                   _fileTypeService.HasMatchingEncodingType(file, ZipEncodingTypes));
        }
        private async Task <bool> IsCsvFile(BlobInfo blob)
        {
            await using var mimeTypeStream = await _fileStorageService.StreamBlob(blob);

            var hasMatchingMimeType = await _fileTypeService.HasMatchingMimeType(
                mimeTypeStream,
                AllowedMimeTypesByFileType[FileType.Data]
                );

            if (!hasMatchingMimeType)
            {
                return(false);
            }

            await using var encodingStream = await _fileStorageService.StreamBlob(blob);

            return(_fileTypeService.HasMatchingEncodingType(encodingStream, CsvEncodingTypes));
        }
 private async Task <bool> IsCsvFile(IFormFile file)
 {
     return(await _fileTypeService.HasMatchingMimeType(file, AllowedMimeTypesByFileType[FileType.Data]) &&
            _fileTypeService.HasMatchingEncodingType(file, CsvEncodingTypes));
 }