SBBMainzReports/ServiceInvoiceReport - Dateiname falsch, wenn Sonderzeichen im Namen, gefixt
SupportOID=167726
This commit is contained in:
@@ -17,6 +17,24 @@ namespace BS.Shared.Core
|
||||
return fileName.IndexOfAny(InvalidFilenameChars) >= 0;
|
||||
}
|
||||
|
||||
public static string SanitizeFilename(string fileName)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fileName) || !ContainsInvalidFilenameChars(fileName))
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
|
||||
var sb = new StringBuilder(fileName.Length);
|
||||
foreach (char c in fileName)
|
||||
{
|
||||
if (!InvalidFilenameChars.Contains(c))
|
||||
{
|
||||
sb.Append(c);
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string GetChecksum(string filePath)
|
||||
{
|
||||
using (FileStream stream = File.OpenRead(filePath))
|
||||
|
||||
Reference in New Issue
Block a user