For missing/invalid extensions, append the correct extension if we know it.
4chan will reject WebMs sent as ".jpg".
This commit is contained in:
parent
746e89bb06
commit
a265abc01a
@ -12,6 +12,15 @@ QR =
|
||||
'swf': 'application/vnd.adobe.flash.movie'
|
||||
'webm': 'video/webm'
|
||||
|
||||
extensionFromType:
|
||||
'image/jpeg': 'jpg'
|
||||
'image/png': 'png'
|
||||
'image/gif': 'gif'
|
||||
'application/pdf': 'pdf'
|
||||
'application/vnd.adobe.flash.movie': 'swf'
|
||||
'application/x-shockwave-flash': 'swf'
|
||||
'video/webm': 'webm'
|
||||
|
||||
init: ->
|
||||
return unless Conf['Quick Reply']
|
||||
|
||||
|
||||
@ -301,10 +301,8 @@ QR.post = class
|
||||
saveFilename: ->
|
||||
@file.newName = (@filename or '').replace /[/\\]/g, '-'
|
||||
unless QR.validExtension.test @filename
|
||||
# 4chan will truncate the filename if it has no extension,
|
||||
# but it will always replace the extension by the correct one,
|
||||
# so we suffix it with '.jpg' when needed.
|
||||
@file.newName += '.jpg'
|
||||
# 4chan will truncate the filename if it has no extension.
|
||||
@file.newName += ".#{QR.extensionFromType[@file.type] or 'jpg'}"
|
||||
|
||||
updateFilename: ->
|
||||
long = "#{@filename} (#{@filesize})"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user