aboutsummaryrefslogtreecommitdiff
path: root/src/services/status_parser
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2016-11-12 22:41:43 +0100
committerRoger Braun <roger@rogerbraun.net>2016-11-12 22:41:43 +0100
commit05733b6bc92db37b8c7bbee792f40125714aa020 (patch)
tree9ca6d461cd20e906115bc5590b1400d315cdd691 /src/services/status_parser
parentc9ab70db8ea5163b2687adf93f6e3f414873df5d (diff)
Remove attachment links, as we are already showing them.
Diffstat (limited to 'src/services/status_parser')
-rw-r--r--src/services/status_parser/status_parser.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/services/status_parser/status_parser.js b/src/services/status_parser/status_parser.js
new file mode 100644
index 00000000..0eb3e75f
--- /dev/null
+++ b/src/services/status_parser/status_parser.js
@@ -0,0 +1,15 @@
+import sanitize from 'sanitize-html'
+
+export const removeAttachmentLinks = (html) => {
+ return sanitize(html, {
+ allowedTags: false,
+ allowedAttributes: false,
+ exclusiveFilter: ({ tag, attribs: { class: klass } }) => tag === 'a' && klass.match(/attachment/)
+ })
+}
+
+export const parse = (html) => {
+ return removeAttachmentLinks(html)
+}
+
+export default parse