All files are getting appended to the first file imported.
Cause:
Seems like the file.end is not getting set (not sure how that should get set).
In the _find function of lib/storage the first file is always returned because file.start = 0 and file.end = Infinity, so the offset is always between those two.
ContentStorage.prototype._find = function (offset, cb) {
for (var i = 0; i < this.files.length; i++) {
var file = this.files[i]
// ALWAYS RETURNS FIRST FILE
if (file.start <= offset && offset < file.end) {
return cb(null, file)
}
}
this._findInFeed(offset, cb)
}
Bug:
All files are getting appended to the first file imported.
Cause:
Seems like the
file.end
is not getting set (not sure how that should get set).In the
_find
function oflib/storage
the first file is always returned becausefile.start = 0
andfile.end = Infinity
, so the offset is always between those two.https://github.com/mafintosh/hyperdrive/blob/hyperdb-backend/lib/storage.js#L53-L62
Reproduce
You can use reproduce with this repo https://github.com/datproject/dat-node/tree/hyperdb by running
node examples/share.js
. Everything will get appended toCHANGELOG.md
.