removed starting - of filenames

This commit is contained in:
soulgalore 2014-10-03 10:43:16 +02:00
parent 147932c454
commit 385cb0c73f
1 changed files with 4 additions and 2 deletions

View File

@ -259,6 +259,10 @@ module.exports = {
// replace all the slashes and if the url is too long
// cut it and add a small md5
name = urlComponents.pathname.replace(/\//g, '-');
if (name.lastIndexOf('-', 0) === 0) {
name = name.slice(1, name.length);
}
if (name.length > lengthBeforeCut) {
name = name.slice(0, lengthBeforeCut);
name = name + crypto.createHash('md5').update(u).digest('hex').substr(0, 5);
@ -454,7 +458,5 @@ module.exports = {
} else {
return key + '.';
}
}
};