Skip to content

Commit f6889c6

Browse files
committed
Always swarm read-only drives
1 parent 8173d56 commit f6889c6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/drives/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class DriveManager extends EventEmitter {
1818
this.opts = opts || {}
1919

2020
this._driveIndex = sub(this.db, 'drives', { valueEncoding: 'json' })
21-
this._nameIndex = sub(this.db, 'names', { valueEncoding: 'utf8' })
21+
this._nameIndex = sub(this.db, 'names', { valueEncoding: 'utf-8' })
2222

2323
if (this.opts.stats) {
2424
this._statsIndex = sub(this.db, 'stats', { valueEncoding: 'json' })
@@ -78,7 +78,7 @@ class DriveManager extends EventEmitter {
7878
}
7979

8080
_generateName (key) {
81-
if (key) return key
81+
if (key) return key.toString('hex')
8282
// TODO: check collisions
8383
return crypto.randomBytes(64).toString('hex')
8484
}
@@ -112,7 +112,7 @@ class DriveManager extends EventEmitter {
112112
newDrive = true
113113
}
114114

115-
const corestore = this.megastore.get(name, { ...this.opts, ...opts })
115+
const corestore = this.megastore.get(name, { ...this.opts })
116116
const driveOpts = {
117117
...opts,
118118
sparse: opts.sparse !== false,

lib/fuse/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class FuseManager extends EventEmitter {
249249
return this._rootDrive.readFile(p.join(relativePath, '.key'), (err, key) => {
250250
if (err && err.errno !== 2) return reject(err)
251251
key = key ? datEncoding.decode(key.toString('utf8')) : opts.key
252-
return this.driveManager.get(key, { ...opts, seed: false })
252+
return this.driveManager.get(key, { ...opts, seed: !!key })
253253
.then(drive => resolve({ drive, root: false, relativePath }))
254254
.catch(reject)
255255
})

0 commit comments

Comments
 (0)