in src/YouTrackSharp/Issues/IssuesService.Attachments.cs [99:119]
public async Task<Stream> DownloadAttachment(Uri attachmentUrl)
{
if (attachmentUrl == null)
{
throw new ArgumentNullException(nameof(attachmentUrl));
}
var client = await _connection.GetAuthenticatedRawClient();
HttpResponseMessage response;
if (!attachmentUrl.IsAbsoluteUri)
{
var siteUrl = $"{client.BaseAddress.Scheme}://{client.BaseAddress.Authority}";
response = await client.GetAsync(siteUrl.TrimEnd('/') + "/" + attachmentUrl.ToString().TrimStart('/'));
}
else
{
response = await client.GetAsync(attachmentUrl);
}
return await response.Content.ReadAsStreamAsync();
}