Permalink
Browse files

backwards compatible links

  • Loading branch information...
joehand committed Jul 5, 2016
1 parent 6cdfd3d commit a32cc3ab361272875085019a54a8ac2c7ed6d470
Showing with 4 additions and 2 deletions.
  1. +1 −1 bin/cli.js
  2. +3 −1 lib/dat.js
View
@@ -46,7 +46,7 @@ function getCommand () {
function isDatLink (val, quiet) {
// TODO: switch to using dat-encoding here
var isLink = (val.length === 50)
var isLink = (val.length === 50 || val.length === 64)
if (quiet || isLink) return isLink
onerror('Invalid Dat Link')
}
View
@@ -23,7 +23,9 @@ function Dat (opts) {
this.dir = opts.dir === '.' ? process.cwd() : opts.dir
this.datPath = opts.datPath || path.join(self.dir, '.dat')
this.key = opts.key ? encoding.decode(opts.key) : null
if (opts.key && opts.key.length === 50) opts.key = encoding.decode(opts.key)
else if (opts.key && opts.key.length === 64) opts.key = Buffer(opts.key, 'hex')
this.key = opts.key
this.snapshot = opts.snapshot
this.ignore = ignore
this.swarm = null

0 comments on commit a32cc3a

Please sign in to comment.