Skip to content

Commit

Permalink
fix(complete-upload): fix bug when completing upload for deep keys
Browse files Browse the repository at this point in the history
  • Loading branch information
olalonde committed Sep 23, 2016
1 parent ca058fd commit 7cc5a80
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@
"type": "git",
"url": "git+https://github.com/blockai/fs-tus-store.git"
},
"keywords": ["tus", "resumable", "upload", "abstract-tus-store", "store", "filesystem", "fs", "local"],
"keywords": [
"tus",
"resumable",
"upload",
"abstract-tus-store",
"store",
"filesystem",
"fs",
"local"
],
"author": "Oli Lalonde <olalonde@gmail.com> (https://syskall.com/)",
"license": "MIT",
"bugs": {
Expand Down Expand Up @@ -61,7 +70,8 @@
"debug": "^2.2.0",
"fs-blob-store": "^5.2.1",
"meterstream": "^1.0.1",
"mkdirp": "^0.5.1",
"string-to-stream": "^1.1.0",
"uuid": "^2.0.3"
}
}
}
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import fsBlobStore from 'fs-blob-store'
import initDebug from 'debug'
import concat from 'concat-stream'
import MeterStream from 'meterstream'
import mkdirpCb from 'mkdirp'
import { SizeStream } from 'common-streams'
import { join, resolve as resolvePath } from 'path'
import { join, resolve as resolvePath, dirname } from 'path'

const debug = initDebug('fs-tus-store')

Expand All @@ -25,8 +26,15 @@ const unlink = (path) => new Promise((resolve, reject) => {
resolve()
})
})
const mkdirp = (path) => new Promise((resolve, reject) => {
mkdirpCb(path, (err) => {
if (err) return reject(err)
resolve()
})
})
const forceSymlink = async (target, path) => {
try {
await mkdirp(dirname(path))
await symlink(target, path)
} catch (err) {
if (err.code === 'EEXIST') {
Expand Down

0 comments on commit 7cc5a80

Please sign in to comment.