mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19235: Fixing possible multi-threading issues when striping characters from string.
This happened to be the reason for scripts/stylesheets not being included in the correct order sometimes. Char array passed might get corrupted when multiple string replacements were done in parallel, making the resulting string incorrect. This method is most commonly used during shape name and alternate generation for resources, hence the issues. Work Item: 19235
This commit is contained in:
@@ -215,13 +215,12 @@ namespace Orchard.Utility.Extensions {
|
||||
return subject;
|
||||
}
|
||||
|
||||
Array.Sort(stripped);
|
||||
var result = new char[subject.Length];
|
||||
|
||||
var cursor = 0;
|
||||
for (var i = 0; i < subject.Length; i++) {
|
||||
char current = subject[i];
|
||||
if (Array.BinarySearch(stripped, current) < 0) {
|
||||
if (Array.IndexOf(stripped, current) < 0) {
|
||||
result[cursor++] = current;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user