better filename parsing; should fix conflict with Exlinks

This commit is contained in:
ccd0 2014-04-19 10:41:22 -07:00
parent 23de0c18bd
commit a54957689a
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,6 @@
**ccd0**
- Fix conflict of previous version with Exlinks.
### v1.7.11
*2014-04-19*

View File

@ -130,7 +130,9 @@ class Post
thumb.src
else
"#{location.protocol}//t.4cdn.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg"
@file.name = fileText.title or fileText.lastElementChild.title or fileText.lastElementChild.textContent
@file.name = fileText.title or do ->
nameNode = $('span', fileText) or $('a', fileText)
nameNode.title or nameNode.textContent
<% if (type === 'crx') { %>
# replace %22 with quotes, see:
# crbug.com/81193
@ -139,8 +141,8 @@ class Post
# http://www.whatwg.org/specs/web-apps/current-work/#multipart-form-data
@file.name = @file.name.replace /%22/g, '"'
<% } %>
@file.isImage = /(jpg|png|gif)$/i.test @file.name
@file.isVideo = /webm$/i.test @file.name
@file.isImage = /(jpg|png|gif)$/i.test @file.URL
@file.isVideo = /webm$/i.test @file.URL
if @file.isImage or @file.isVideo
@file.dimensions = fileText.textContent.match(/\d+x\d+/)[0]