appendix: 23 Code-Ausschnitte aus dem Houston-Repository
Pin nixpkgs to the revision used by itc.componentware: the channel version ships a latexminted that crashes on Python 3.14, which made every listing fail and sent latexmk into an endless error prompt. Also force nonstopmode/halt-on-error so a broken listing can never loop again.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
public async Task<string?> TryGetUrlFileIconClassAsync(DocumentKey doc, CancellationToken cancellationToken)
|
||||
{
|
||||
var ini = await TryReadUrlFileAsync(doc, cancellationToken);
|
||||
var iconFile = ini?.GetValue("InternetShortcut", "IconFile");
|
||||
|
||||
return String.IsNullOrEmpty(iconFile) ? null : iconFile;
|
||||
}
|
||||
|
||||
private async Task<string?> TryGetUrlFileTargetAsync(DocumentKey doc, CancellationToken cancellationToken)
|
||||
{
|
||||
var ini = await TryReadUrlFileAsync(doc, cancellationToken);
|
||||
var target = ini?.GetValue("InternetShortcut", "URL");
|
||||
|
||||
if (String.IsNullOrWhiteSpace(target))
|
||||
return null;
|
||||
|
||||
if (!Uri.TryCreate(target, UriKind.Absolute, out var uri))
|
||||
return null;
|
||||
|
||||
if (!(uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps))
|
||||
return null;
|
||||
|
||||
return uri.ToString();
|
||||
}
|
||||
|
||||
private async Task<IniDocument?> TryReadUrlFileAsync(DocumentKey doc, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var response = await s3.GetObjectAsync(new GetObjectRequest
|
||||
{
|
||||
BucketName = _settings.S3.Bucket,
|
||||
Key = doc.ToString(),
|
||||
}, cancellationToken);
|
||||
|
||||
using var reader = new StreamReader(response.ResponseStream);
|
||||
return await iniParser.ParseAsync(reader, cancellationToken);
|
||||
}
|
||||
catch (AmazonS3Exception exception) when (exception.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user