Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

change utils.uid() to return url-safe chars. Closes #753

  • Loading branch information...
commit 44e89f8d81f6e16e711ee065f0e0265ac2e77742 1 parent 1341daa
@tj tj authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/utils.js
View
6 lib/utils.js
@@ -82,7 +82,7 @@ exports.md5 = function(str, encoding){
*
* var a = { foo: 'bar' }
* , b = { bar: 'baz' };
- *
+ *
* utils.merge(a, b);
* // => { foo: 'bar', bar: 'baz' }
*
@@ -132,7 +132,9 @@ exports.escape = function(html){
exports.uid = function(len) {
return crypto.randomBytes(Math.ceil(len * 3 / 4))
.toString('base64')
- .slice(0, len);
+ .slice(0, len)
+ .replace(/\//g, '-')
+ .replace(/\+/g, '_');
};
/**
Please sign in to comment.
Something went wrong with that request. Please try again.