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'
|
'swf': 'application/vnd.adobe.flash.movie'
|
||||||
'webm': 'video/webm'
|
'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: ->
|
init: ->
|
||||||
return unless Conf['Quick Reply']
|
return unless Conf['Quick Reply']
|
||||||
|
|
||||||
|
|||||||
@ -301,10 +301,8 @@ QR.post = class
|
|||||||
saveFilename: ->
|
saveFilename: ->
|
||||||
@file.newName = (@filename or '').replace /[/\\]/g, '-'
|
@file.newName = (@filename or '').replace /[/\\]/g, '-'
|
||||||
unless QR.validExtension.test @filename
|
unless QR.validExtension.test @filename
|
||||||
# 4chan will truncate the filename if it has no extension,
|
# 4chan will truncate the filename if it has no extension.
|
||||||
# but it will always replace the extension by the correct one,
|
@file.newName += ".#{QR.extensionFromType[@file.type] or 'jpg'}"
|
||||||
# so we suffix it with '.jpg' when needed.
|
|
||||||
@file.newName += '.jpg'
|
|
||||||
|
|
||||||
updateFilename: ->
|
updateFilename: ->
|
||||||
long = "#{@filename} (#{@filesize})"
|
long = "#{@filename} (#{@filesize})"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user