fix(card-master): degrade payload provider gracefully on IO error or empty file
This commit is contained in:
@@ -35,8 +35,27 @@ public sealed class CardMasterPayloadProvider : ICardMasterPayloadProvider
|
||||
IsAvailable = false;
|
||||
return;
|
||||
}
|
||||
Base64Blob = File.ReadAllText(path).Trim();
|
||||
IsAvailable = Base64Blob.Length > 0;
|
||||
log.LogInformation("Loaded card-master blob ({Bytes} base64 chars).", Base64Blob.Length);
|
||||
string content;
|
||||
try
|
||||
{
|
||||
content = File.ReadAllText(path).Trim();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
log.LogError(ex, "Failed reading card-master blob at {Path} — /immutable_data/card_master will 503.", path);
|
||||
Base64Blob = "";
|
||||
IsAvailable = false;
|
||||
return;
|
||||
}
|
||||
if (content.Length == 0)
|
||||
{
|
||||
log.LogWarning("Card-master blob at {Path} is empty — /immutable_data/card_master will 503.", path);
|
||||
Base64Blob = "";
|
||||
IsAvailable = false;
|
||||
return;
|
||||
}
|
||||
Base64Blob = content;
|
||||
IsAvailable = true;
|
||||
log.LogInformation("Loaded card-master blob from {Path} ({Bytes} base64 chars).", path, Base64Blob.Length);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user