Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[fix] don't start with -, this causes some issues on *nix fs
  • Loading branch information
julianduque committed Apr 24, 2013
1 parent 995fc31 commit ae5c15f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/haibu/common/index.js
Expand Up @@ -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));
}
}
});
}

Expand Down Expand Up @@ -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');
};

//
Expand All @@ -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.