mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#20078: Fixing international characters loss in media profiles
Work Item: 20078
This commit is contained in:
@@ -197,11 +197,20 @@ namespace Orchard.MediaProcessing.Services {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static readonly char[] _disallowed = @"/:?#\[\]@!$&'()*+,.;=\s\""\<\>\\\|%".ToCharArray();
|
||||
|
||||
private static string CreateDefaultFileName(string path) {
|
||||
var extention = Path.GetExtension(path);
|
||||
var newPath = Path.ChangeExtension(path, "");
|
||||
newPath = newPath.Replace(@"/", "_");
|
||||
return newPath.ToSafeName() + extention;
|
||||
newPath = newPath.TrimEnd('.').RemoveDiacritics();
|
||||
var normalized = newPath.ToCharArray();
|
||||
for (var i = 0; i < normalized.Length; i++) {
|
||||
if (Array.IndexOf(_disallowed, normalized[i]) >= 0) {
|
||||
normalized[i] = '_';
|
||||
}
|
||||
}
|
||||
|
||||
return new string(normalized) + extention;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user