[node.js] Upload an image to ckeditor

Asked 2 years ago, Updated 2 years ago, 40 views

Hello, I am using ckeditor to implement the bulletin board with node.js.

As shown above, it was transferred to the server and saved in mysql so that if you post, you can upload the picture.

The results keep coming out to the address.

How can I solve this problem?

node.js

2022-09-22 21:10

1 Answers

It's because it's filtered.

If it is not filtered, the img is inserted as it is, and if it is filtered, the html code is inserted as you can see.

The reason is to prevent XSS attacks. You could be hacked

I don't know what template engine you're using, but you have to find a phrase that doesn't filter and put it in

If you search for template engine +unescape tml you are using on Google, you will get the code

If you use ejs, ejsunescape tml like this.

If you're using ejs while you're at it,

<%- code %>

If you do this, it becomes an escape.


2022-09-22 21:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.