зеркало из https://github.com/mozilla/gecko-dev.git
truncate microsummary file names to 60 characters to prevent nsIFile.createUnique from failing due to too-long names
Patch by Joey Minta. bug=342212 r=myk
This commit is contained in:
Родитель
26a1119b47
Коммит
4b19461842
|
@ -1829,6 +1829,7 @@ function getLoadedMicrosummaryResource(uri) {
|
|||
*/
|
||||
function sanitizeName(aName) {
|
||||
const chars = "-abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
const maxLength = 60;
|
||||
|
||||
var name = aName.toLowerCase();
|
||||
name = name.replace(/ /g, "-");
|
||||
|
@ -1847,6 +1848,9 @@ function sanitizeName(aName) {
|
|||
name += chars.charAt(Math.round(Math.random() * (chars.length - 1)));
|
||||
}
|
||||
|
||||
if (name.length > maxLength)
|
||||
name = name.substring(0, maxLength);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче