Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit b1388a1

Browse files
achingbrainAlan Shaw
authored and
Alan Shaw
committed
chore: encode buffers before printing (#2164)
Printing raw buffers can end up outputting characters into the terminal that mess up the encoding for all subsequent lines, which is a pain when debugging things. This change just encodes the buffer before printing to stop that from happening.
1 parent 9e2171b commit b1388a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/core/ipns/publisher.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ class IpnsPublisher {
108108
// Add record to routing (buffer key)
109109
this._routing.put(key.toBuffer(), entryData, (err, res) => {
110110
if (err) {
111-
const errMsg = `ipns record for ${key.toString()} could not be stored in the routing`
111+
const errMsg = `ipns record for ${key.toString('base64')} could not be stored in the routing`
112112

113113
log.error(errMsg)
114114
return callback(errcode(new Error(errMsg), 'ERR_PUTTING_TO_ROUTING'))
115115
}
116116

117-
log(`ipns record for ${key.toString()} was stored in the routing`)
117+
log(`ipns record for ${key.toString('base64')} was stored in the routing`)
118118
callback(null, res)
119119
})
120120
}
@@ -137,13 +137,13 @@ class IpnsPublisher {
137137
// Add public key to routing (buffer key)
138138
this._routing.put(key.toBuffer(), publicKey.bytes, (err, res) => {
139139
if (err) {
140-
const errMsg = `public key for ${key.toString()} could not be stored in the routing`
140+
const errMsg = `public key for ${key.toString('base64')} could not be stored in the routing`
141141

142142
log.error(errMsg)
143143
return callback(errcode(new Error(errMsg), 'ERR_PUTTING_TO_ROUTING'))
144144
}
145145

146-
log(`public key for ${key.toString()} was stored in the routing`)
146+
log(`public key for ${key.toString('base64')} was stored in the routing`)
147147
callback(null, res)
148148
})
149149
}

0 commit comments

Comments
 (0)