Bug 345319: installation of an engine with a very long name can fail, original patch by Joey Minta <jminta@gmail.com>, r=mconnor

This commit is contained in:
gavin%gavinsharp.com 2006-07-21 12:52:57 +00:00
parent 91dcbae45b
commit 88413cff00

View File

@ -665,6 +665,7 @@ function getSanitizedFile(aName) {
*/
function sanitizeName(aName) {
const chars = "-abcdefghijklmnopqrstuvwxyz0123456789";
const maxLength = 60;
var name = aName.toLowerCase();
name = name.replace(/ /g, "-");
@ -679,6 +680,9 @@ function sanitizeName(aName) {
name += chars.charAt(Math.round(Math.random() * cl));
}
if (name.length > maxLength)
name = name.substring(0, maxLength);
return name;
}