mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 08:23:28 -03:00
fix file modification date comparisons (#14503)
This commit is contained in:
@@ -1430,9 +1430,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var info = FileSystem.GetFileSystemInfo(Path);
|
||||
|
||||
return info.Exists
|
||||
? info.LastWriteTimeUtc != DateModified
|
||||
: false;
|
||||
return info.Exists && this.HasChanged(info.LastWriteTimeUtc);
|
||||
}
|
||||
|
||||
public virtual List<string> GetUserDataKeys()
|
||||
|
||||
@@ -114,5 +114,19 @@ namespace MediaBrowser.Controller.Entities
|
||||
source.DeepCopy(dest);
|
||||
return dest;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the item has changed.
|
||||
/// </summary>
|
||||
/// <param name="source">The source object.</param>
|
||||
/// <param name="asOf">The timestamp to detect changes as of.</param>
|
||||
/// <typeparam name="T">Source type.</typeparam>
|
||||
/// <returns>Whether the item has changed.</returns>
|
||||
public static bool HasChanged<T>(this T source, DateTime asOf)
|
||||
where T : BaseItem
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(source);
|
||||
return source.DateModified.Subtract(asOf).Duration().TotalSeconds > 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user