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

Commit

Permalink
Make variable names a bit clearer.
Browse files Browse the repository at this point in the history
  • Loading branch information
hackergrrl committed May 19, 2016
1 parent 5516717 commit 6728786
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/http-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ exports = module.exports = function HttpApi (repo) {

this.start = (callback) => {
if (typeof repo === 'string') {
console.log('here')
repo = new IPFSRepo(repo, {stores: fsbs})
}

Expand Down
12 changes: 6 additions & 6 deletions src/http-api/resources/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ exports.add = {

const parser = multipart.reqParser(request.payload)

var file = false
var written = 0
var filesParsed = false
var filesAdded = 0

var serialize = ndjson.serialize()
// hapi doesn't permit object streams: http://hapijs.com/api#replyerr-result
Expand All @@ -31,11 +31,11 @@ exports.add = {
Name: file.path,
Hash: bs58.encode(file.multihash).toString()
})
written++
filesAdded++
})

fileAdder.on('end', () => {
if (written === 0 && file) {
if (filesAdded === 0 && filesParsed) {
return reply({
Message: 'Failed to add files',
Code: 0
Expand All @@ -53,12 +53,12 @@ exports.add = {
path: fileName,
stream: fileStream
}
file = true
filesParsed = true
fileAdder.write(filePair)
})

parser.on('end', () => {
if (!file) {
if (!filesParsed) {
return reply("File argument 'data' is required").code(400).takeover()
}
fileAdder.end()
Expand Down

0 comments on commit 6728786

Please sign in to comment.