SECURITY: Escape HTML in filename.

This commit is contained in:
Guo Xiang Tan
2016-08-11 11:27:12 +08:00
parent 8dab20e5b8
commit 11afb20772
2 changed files with 10 additions and 2 deletions

View File

@ -270,9 +270,9 @@ class CookedPostProcessor
informations = "#{original_width}x#{original_height}"
informations << " #{number_to_human_size(upload.filesize)}" if upload
a["title"] = img["title"] || filename
a["title"] = CGI.escapeHTML(img["title"] || filename)
meta.add_child create_span_node("filename", img["title"] || filename)
meta.add_child create_span_node("filename", a["title"])
meta.add_child create_span_node("informations", informations)
meta.add_child create_span_node("expand")
end