Fix #3197 - Post Replacement comment: use Replacement URL instead of Final Source

Record the URL of the image that was actually downloaded as the replacement URL.
This commit is contained in:
evazion
2017-07-02 20:57:41 -05:00
parent 5a2745ee71
commit c3ac4f3329
4 changed files with 19 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ module Downloads
class Error < Exception ; end
attr_reader :data, :options
attr_accessor :source, :original_source, :content_type, :file_path
attr_accessor :source, :original_source, :downloaded_source, :content_type, :file_path
def initialize(source, file_path, options = {})
# source can potentially get rewritten in the course
@@ -11,6 +11,9 @@ module Downloads
@source = source
@original_source = source
# the URL actually downloaded after rewriting the original source.
@downloaded_source = nil
# where to save the download
@file_path = file_path
@@ -43,6 +46,7 @@ module Downloads
response.read_body(out)
end
end
@downloaded_source = @source
@source = after_download(@source)
end