diff --git a/4chan_x.user.js b/4chan_x.user.js index a2e94cf3c..8da72d76f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -737,7 +737,7 @@ } this.file.size = size; this.file.thumbURL = that.isArchived ? thumb.src : "" + location.protocol + "//thumbs.4chan.org/" + board + "/thumb/" + (this.file.URL.match(/(\d+)\./)[1]) + "s.jpg"; - this.file.name = $('span[title]', this.file.info).title; + this.file.name = $('span[title]', this.file.info).title.replace(/%22/g, '"'); if (this.file.isImage = /(jpg|png|gif)$/i.test(this.file.name)) { this.file.dimensions = this.file.text.textContent.match(/\d+x\d+/)[0]; } diff --git a/script.coffee b/script.coffee index 8b46f22a2..0ccda9e16 100644 --- a/script.coffee +++ b/script.coffee @@ -586,7 +586,12 @@ class Post thumb.src else "#{location.protocol}//thumbs.4chan.org/#{board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg" - @file.name = $('span[title]', @file.info).title + # replace %22 with quotes, see: + # crbug.com/81193 + # webk.it/62107 + # https://www.w3.org/Bugs/Public/show_bug.cgi?id=16909 + # http://www.whatwg.org/specs/web-apps/current-work/#multipart-form-data + @file.name = $('span[title]', @file.info).title.replace /%22/g, '"' if @file.isImage = /(jpg|png|gif)$/i.test @file.name @file.dimensions = @file.text.textContent.match(/\d+x\d+/)[0]