Skip to content

Commit

Permalink
ouput dat:// in front of links
Browse files Browse the repository at this point in the history
  • Loading branch information
okdistribute committed Dec 15, 2016
1 parent 47f5af0 commit 137d28b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ui/link.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var datKeyAs = require('dat-key-as')

module.exports = function (key) {
return `Link: ${datKeyAs.str(key)}`
return `Link: dat://${datKeyAs.str(key)}`
}
9 changes: 8 additions & 1 deletion tests/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var os = require('os')
var path = require('path')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var asDatKey = require('dat-key-as').string
var recursiveReadSync = require('recursive-readdir-sync')
var Dat = require('dat-node')
var hypercore = require('hypercore')
Expand Down Expand Up @@ -54,7 +55,13 @@ function newTestFolder () {
function matchDatLink (str) {
var match = str.match(/[A-Za-z0-9]{64}/)
if (!match) return false
return match[0].trim()
var key
try {
key = asDatKey(match[0].trim())
} catch (e) {
return false
}
return key
}

function isDir (dir) {
Expand Down

0 comments on commit 137d28b

Please sign in to comment.