Open ttys3 opened 1 year ago
maybe related to
public static string? GetContentDispositionFileName(string contentDisposition)
{
try
{
var r1 = new Regex(@"\s*filename\*\s*=\s*[^']*\'\s*\'(.*)");
var r2 = new Regex("\\s*filename\\s*=\\s*\"([^\"]*)\"");
var r3 = new Regex("filename\\s*=\\s*([^\"]+)");
//var contentDisposition = response.Headers.Get("Content-Disposition");
if (contentDisposition != null)
{
Log.Debug("Trying to get filename from: " + contentDisposition);
foreach (var r in new Regex[] { r1, r2, r3 })
{
var m = r.Match(contentDisposition);
if (m.Success && m.Groups.Count >= 2)
{
return FileHelper.SanitizeFileName(Uri.UnescapeDataString(m.Groups[1].Value));
}
}
}
}
catch (Exception ex)
{
Log.Debug(ex, ex.Message);
}
return null;
}
PR submitted: https://github.com/subhra74/xdm/pull/1013
XDM is currently being re-written to be more user friendly and performant, please refer to (https://github.com/subhra74/xdm/discussions/768) for more information
PLEASE DO NOT JUST SAY "It does not work, or something not working etc." Provide enough relevent details so that the issue can be analyzed and reproduced easily
Describe the bug
can not handle filename correctly like:
Content-Disposition: attachment;filename*=utf-8''aaaa.rar; filename="aaaa.rar"
the final saved filename by xdm is
aaaa.rar; filename="aaaa.rar"
is wrong.To Reproduce Steps to reproduce the behavior:
you will get header like
Content-Disposition: attachment;filename*=utf-8''xxxx%2Erar;filename="xxxx.rar"
Expected behavior
filename should be
aaaa.rar
, notaaaa.rar; filename="aaaa.rar"
please complete the following information:
Additional context Add any other context about the problem here.