Skip to content
Permalink
Browse files

[fix] don't start with -, this causes some issues on *nix fs

  • Loading branch information...
julianduque committed Apr 24, 2013
1 parent 995fc31 commit ae5c15fdc2f0b93a20babc1aacb8c5a35bfe1a8b
Showing with 11 additions and 11 deletions.
  1. +11 −11 lib/haibu/common/index.js
@@ -22,15 +22,15 @@ var common = module.exports = flatiron.common;
// **REALLY DONT DO THIS HERE! But where?**
//
if (!Error.prototype.toJSON) {
Object.defineProperty(Error.prototype, "toJSON", {
enumerable: false,
value: function () {
return flatiron.common.mixin({
message: this.message,
stack: this.stack,
Object.defineProperty(Error.prototype, "toJSON", {
enumerable: false,
value: function () {
return flatiron.common.mixin({
message: this.message,
stack: this.stack,
arguments: this.arguments
}, flatiron.common.clone(this));
}
}
});
}

@@ -147,7 +147,7 @@ common.sanitizeAppname = function (name) {
var sha1 = crypto.createHash('sha1');

sha1.update(name);
return name.replace(/[^a-z0-9\-\_]+/g, '-') + '-' + sha1.digest('hex');
return name.replace(/[^a-z0-9\-\_]+/g, '') + '_' + sha1.digest('hex');
};

//
@@ -159,15 +159,15 @@ common.sanitizeAppname = function (name) {
//
common.ipAddress = function (name) {
var interfaces = os.networkInterfaces();

var addresses = Object.keys(interfaces).map(function (nic) {
var addrs = interfaces[nic].filter(function (details) {
return details.address !== '127.0.0.1' && details.family === 'IPv4'
});
return addrs.length ? addrs[0].address : undefined;
}).filter(Boolean);

return addresses.length
? addresses[0]
: '127.0.0.1';
};
};

0 comments on commit ae5c15f

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.