aboutsummaryrefslogtreecommitdiff
path: root/src/services/status_parser/status_parser.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/services/status_parser/status_parser.js')
-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