diff --git a/src/Miscellaneous/FileInfo.coffee b/src/Miscellaneous/FileInfo.coffee
index 923bd3ce5..951f8ab30 100755
--- a/src/Miscellaneous/FileInfo.coffee
+++ b/src/Miscellaneous/FileInfo.coffee
@@ -25,13 +25,13 @@ FileInfo =
size.toFixed()
"#{size} #{unit}"
escape: (name) ->
- name.replace /<|>/g, (c) ->
- c is '<' and '<' or '>'
+ name.replace /[&"'<>]/g, (c) ->
+ {'&': '&', "'": ''', '"': '"', '<': '<', '>': '>'}[c]
formatters:
- t: -> @file.URL.match(/\d+\..+$/)[0]
- T: -> "#{FileInfo.formatters.t.call @}"
- l: -> "#{FileInfo.formatters.n.call @}"
- L: -> "#{FileInfo.formatters.N.call @}"
+ t: -> FileInfo.escape @file.URL.match(/\d+\..+$/)[0]
+ T: -> "#{FileInfo.formatters.t.call @}"
+ l: -> "#{FileInfo.formatters.n.call @}"
+ L: -> "#{FileInfo.formatters.N.call @}"
n: ->
fullname = @file.name
shortname = Build.shortFilename @file.name, @isReply
@@ -41,8 +41,8 @@ FileInfo =
"#{FileInfo.escape shortname}#{FileInfo.escape fullname}"
N: -> FileInfo.escape @file.name
p: -> if @file.isSpoiler then 'Spoiler, ' else ''
- s: -> @file.size
+ s: -> FileInfo.escape @file.size
B: -> FileInfo.convertUnit @file.sizeInBytes, 'B'
K: -> FileInfo.convertUnit @file.sizeInBytes, 'KB'
M: -> FileInfo.convertUnit @file.sizeInBytes, 'MB'
- r: -> if @file.isImage or @file.isVideo then @file.dimensions else 'PDF'
+ r: -> FileInfo.escape (@file.dimensions or 'PDF')