Fixed invalid filenames
This commit is contained in:
parent
5c45aad049
commit
5ea5abfdfd
|
@ -229,8 +229,7 @@ namespace DML.AppCore.Classes
|
|||
var socketTextChannel = message.Channel as SocketTextChannel;
|
||||
if (socketTextChannel != null)
|
||||
{
|
||||
serverName = socketTextChannel.Guild.Name.Replace(":", "").Replace("/", "")
|
||||
.Replace("\\", "").Replace("|", "");
|
||||
serverName = socketTextChannel.Guild.Name;
|
||||
}
|
||||
|
||||
fileName =
|
||||
|
@ -240,6 +239,8 @@ namespace DML.AppCore.Classes
|
|||
.Replace("%name%", a.Filename)
|
||||
.Replace("%id%", a.Id.ToString());
|
||||
|
||||
fileName = Path.GetInvalidFileNameChars().Aggregate(fileName, (current, c) => current.Replace(c, ' '));
|
||||
|
||||
if (extensionRequired)
|
||||
fileName += Path.GetExtension(a.Filename);
|
||||
|
||||
|
|
Loading…
Reference in a new issue