git ssb

16+

Dominic / patchbay



Commit 4b8b575056eccf0674ea21d953dcb8e779930049

normalise URIencoded message links so you are redirected to an acutal message

mix irving committed on 3/1/2018, 10:19:06 PM
Parent: dc2e96d4d0a86072d9393a2d15d786a80cb341ff

Files changed

router/async/normalise.jschanged
router/async/normalise.jsView
@@ -11,10 +11,19 @@
1111 exports.create = (api) => {
1212 return nest('router.async.normalise', normalise)
1313
1414 function normalise (location, cb) {
15- if (typeof location === 'object') cb(null, location)
16- else if (isMsg(location)) {
15 + if (typeof location === 'object') {
16 + cb(null, location)
17 + return true
18 + }
19 +
20 + // if someone has given you an annoying html encoded location
21 + if (location.match(/^%25.*%3D.sha256$/)) {
22 + location = decodeURIComponent(location)
23 + }
24 +
25 + if (isMsg(location)) {
1726 api.sbot.async.get(location, (err, value) => {
1827 if (err) cb(err)
1928 else {
2029 if (typeof value.content === 'string') value = api.message.sync.unbox(value)

Built with git-ssb-web