mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-06 06:12:52 +01:00
Use InvariantCulture when parsing machine-generated dates
DateTime.TryParse without an IFormatProvider falls back to the current thread culture, so the same string can parse differently (or fail) depending on the server's locale. None of these call sites deal with user-entered text - they parse dates that come from filenames, an HTTP header, ffprobe metadata and values the app itself wrote to the auth database - so InvariantCulture is the correct provider everywhere here. Fixes the S6580 / CA1305 warnings on these call sites. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Emby.Server.Implementations.Data;
|
||||
using Jellyfin.Database.Implementations;
|
||||
@@ -79,9 +80,9 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||
foreach (var row in authenticatedDevices)
|
||||
{
|
||||
var dateCreatedStr = row.GetString(9);
|
||||
_ = DateTime.TryParse(dateCreatedStr, out var dateCreated);
|
||||
_ = DateTime.TryParse(dateCreatedStr, CultureInfo.InvariantCulture, out var dateCreated);
|
||||
var dateLastActivityStr = row.GetString(10);
|
||||
_ = DateTime.TryParse(dateLastActivityStr, out var dateLastActivity);
|
||||
_ = DateTime.TryParse(dateLastActivityStr, CultureInfo.InvariantCulture, out var dateLastActivity);
|
||||
|
||||
if (row.IsDBNull(6))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user