Browse Source

Add RemoveQuotes method.

pull/9426/head
maliming 5 years ago
parent
commit
f3c77764a5
  1. 15
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs

15
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs

@ -10,6 +10,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
using Volo.Abp.Content;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
@ -115,8 +116,8 @@ namespace Volo.Abp.Http.Client.DynamicProxying
return (T)(object)new RemoteStreamContent(await responseContent.ReadAsStreamAsync())
{
ContentType = responseContent.Headers.ContentType?.ToString(),
FileName = responseContent.Headers?.ContentDisposition?.FileNameStar ??
responseContent.Headers?.ContentDisposition?.FileName?.RemovePreFix("\"")?.RemovePostFix("\"")
FileName = responseContent.Headers?.ContentDisposition?.FileNameStar ??
RemoveQuotes(responseContent.Headers?.ContentDisposition?.FileName).ToString()
};
}
@ -295,6 +296,16 @@ namespace Volo.Abp.Http.Client.DynamicProxying
};
}
protected virtual StringSegment RemoveQuotes(StringSegment input)
{
if (!StringSegment.IsNullOrEmpty(input) && input.Length >= 2 && input[0] == '"' && input[input.Length - 1] == '"')
{
input = input.Subsegment(1, input.Length - 2);
}
return input;
}
protected virtual CancellationToken GetCancellationToken()
{
return CancellationTokenProvider.Token;

Loading…
Cancel
Save