Skip to content

Commit

Permalink
Fix: Fixed QuickLook support (files-community#16189)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 authored Sep 13, 2024
1 parent 5fc70d3 commit 98c7408
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@ public async Task SwitchPreviewAsync(string path)
private async Task DoPreviewAsync(string path, string message)
{
string pipeName = $"QuickLook.App.Pipe.{WindowsIdentity.GetCurrent().User?.Value}";
var encoding = Encoding.GetEncoding("UTF-8", new EncoderReplacementFallback("?"), new DecoderExceptionFallback());

await using var client = new NamedPipeClientStream(".", pipeName, PipeDirection.Out);
try
{
await client.ConnectAsync(TIMEOUT);

await using var writer = new StreamWriter(client, encoding);
await using var writer = new StreamWriter(client);
await writer.WriteLineAsync($"{message}|{path}");
await writer.FlushAsync();
}
catch (Exception ex) when (ex is TimeoutException or IOException)
catch (Exception ex) when (ex is TimeoutException or IOException or EncoderFallbackException)
{
// ignore
}
Expand Down

0 comments on commit 98c7408

Please sign in to comment.