I was testing things for localized content, in the 1.10.x branch.
In a French .po file for a module I have there was an error. A line is
This is clearly wrong.
The behaviour when opening a French content in the front-end was to throw out an Exception page with the whole call stack.
The fault was happening in the TrimQuote(string) method in
Orchard/src/Orchard/Localization/Services/LocalizationStreamParser.cs
(https://github.com/OrchardCMS/Orchard/blob/1.10.x/src/Orchard/Localization/Services/LocalizationStreamParser.cs)
That faulty line in my po file results in the TrimQuote method being passed str = "\"" as parameter. This verifies the condition, but causes an exception when calling Substring(int, int), because str.Length == 1.
I am not sure how that line ended in the po file, but it makes me think that it's not safe to assume, in the code, that .po files will always be well formatted. At the very least, errors in the .po file should be handled in such a way that avoids crashing the application.
I was testing things for localized content, in the 1.10.x branch.
In a French .po file for a module I have there was an error. A line is
This is clearly wrong.
The behaviour when opening a French content in the front-end was to throw out an Exception page with the whole call stack.
The fault was happening in the
TrimQuote(string)method inOrchard/src/Orchard/Localization/Services/LocalizationStreamParser.cs
(https://github.com/OrchardCMS/Orchard/blob/1.10.x/src/Orchard/Localization/Services/LocalizationStreamParser.cs)
That faulty line in my po file results in the TrimQuote method being passed
str = "\""as parameter. This verifies the condition, but causes an exception when callingSubstring(int, int), becausestr.Length == 1.I am not sure how that line ended in the po file, but it makes me think that it's not safe to assume, in the code, that .po files will always be well formatted. At the very least, errors in the .po file should be handled in such a way that avoids crashing the application.