mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Use stable images ids to prevent duplicated
This commit is contained in:
parent
7824a78e85
commit
a8eb1c52b6
@ -24,7 +24,6 @@ using System.Net.Http;
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
|
||||||
using Blurhash.SkiaSharp;
|
using Blurhash.SkiaSharp;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models;
|
using Kyoo.Abstractions.Models;
|
||||||
@ -80,7 +79,11 @@ public class ThumbnailsManager(
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (image.Id == Guid.Empty)
|
if (image.Id == Guid.Empty)
|
||||||
image.Id = Guid.NewGuid();
|
{
|
||||||
|
// Ensure stable ids to prevent duplicated images being stored on the fs.
|
||||||
|
using MD5 md5 = MD5.Create();
|
||||||
|
image.Id = new Guid(md5.ComputeHash(Encoding.UTF8.GetBytes(image.Source)));
|
||||||
|
}
|
||||||
|
|
||||||
logger.LogInformation("Downloading image {What}", what);
|
logger.LogInformation("Downloading image {What}", what);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user