mirror of
				https://github.com/Kareadita/Kavita.git
				synced 2025-10-31 10:37:04 -04:00 
			
		
		
		
	* Fixed an oversight where unique file extensions for KavitaStats wouldn't ignore case. * Fixed an issue where series were getting removed then re-added due to bad logic when comparing if the series from disk matched the series in DB based on format.
		
			
				
	
	
		
			36 lines
		
	
	
		
			897 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			897 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System.Collections.Generic;
 | |
| using System.IO;
 | |
| using System.Linq;
 | |
| using System.Threading.Tasks;
 | |
| using API.Interfaces;
 | |
| using Microsoft.EntityFrameworkCore;
 | |
| 
 | |
| namespace API.Data
 | |
| {
 | |
|     public class FileRepository : IFileRepository
 | |
|     {
 | |
|         private readonly DataContext _dbContext;
 | |
| 
 | |
|         public FileRepository(DataContext context)
 | |
|         {
 | |
|             _dbContext = context;
 | |
|         }
 | |
| 
 | |
|         public async Task<IEnumerable<string>> GetFileExtensions()
 | |
|         {
 | |
|             var fileExtensions = await _dbContext.MangaFile
 | |
|                 .AsNoTracking()
 | |
|                 .Select(x => x.FilePath.ToLower())
 | |
|                 .Distinct()
 | |
|                 .ToArrayAsync();
 | |
| 
 | |
|             var uniqueFileTypes = fileExtensions
 | |
|                 .Select(Path.GetExtension)
 | |
|                 .Where(x => x is not null)
 | |
|                 .Distinct();
 | |
| 
 | |
|             return uniqueFileTypes;
 | |
|         }
 | |
|     }
 | |
| }
 |