git ssb

7+

dinoworm 🐛 / patchcore



Commit a61f3a4f15d549be32ee33146be221e1f525cea3

include contentType in request url for embedded blobs

allows for embedded video/audio and sets correct mime type
Matt McKegg committed on 4/13/2018, 5:54:32 AM
Parent: 6c7863e4b2ff580dd8b633623387fb444ccd5256

Files changed

message/html/markdown.jschanged
message/html/markdown.jsView
@@ -19,11 +19,15 @@
1919 function markdown (content) {
2020 if (typeof content === 'string') { content = {text: content} }
2121 // handle patchwork style mentions and custom emoji.
2222 var mentions = {}
23 + var typeLookup = {}
2324 var emojiMentions = {}
2425 if (Array.isArray(content.mentions)) {
2526 content.mentions.forEach(function (link) {
27 + if (link && link.link && link.type) {
28 + typeLookup[link.link] = link.type
29 + }
2630 if (link && link.name && link.link) {
2731 if (link.emoji) emojiMentions[link.name] = link.link
2832 else mentions['@' + link.name] = link.link
2933 }
@@ -41,9 +45,18 @@
4145 : api.emoji.sync.url(emoji)
4246 return renderEmoji(emoji, url)
4347 },
4448 toUrl: (id) => {
45- if (id.startsWith('&')) return api.blob.sync.url(id)
49 + if (id.startsWith('&')) {
50 + var url = api.blob.sync.url(id)
51 +
52 + if (typeLookup[id]) {
53 + var separator = url.includes('?') ? '&' : '?'
54 + url += separator + 'contentType=' + escape(typeLookup[id])
55 + }
56 +
57 + return url
58 + }
4659 if (mentions[id]) {
4760 return mentions[id]
4861 } else if (ref.isLink(id) || id.startsWith('#') || id.startsWith('?')) {
4962 return id

Built with git-ssb-web