mirror of
https://github.com/discourse/discourse.git
synced 2024-12-28 12:58:00 +08:00
9e241e82e9
https://meta.discourse.org/t/markdown-preview-and-result-differ/263878 The result of this markdown had different results in the composer preview and the post. This is solved by updating Loofah to the latest version and using html5 fragments like our user had reported. While the change was only needed in cooked_post_processor.rb for this fix, other areas also had to be updated due to various side effects.
39 lines
1002 B
Ruby
39 lines
1002 B
Ruby
# frozen_string_literal: true
|
|
|
|
class PostHotlinkedMedia < ActiveRecord::Base
|
|
belongs_to :post
|
|
belongs_to :upload
|
|
enum status: {
|
|
downloaded: "downloaded",
|
|
too_large: "too_large",
|
|
download_failed: "download_failed",
|
|
upload_create_failed: "upload_create_failed",
|
|
}
|
|
|
|
def self.normalize_src(src, reset_scheme: true)
|
|
uri = Addressable::URI.heuristic_parse(src)
|
|
uri.normalize!
|
|
uri.scheme = nil if reset_scheme
|
|
uri.to_s
|
|
rescue URI::Error, Addressable::URI::InvalidURIError
|
|
src
|
|
end
|
|
end
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: post_hotlinked_media
|
|
#
|
|
# id :bigint not null, primary key
|
|
# post_id :bigint not null
|
|
# url :string not null
|
|
# status :enum not null
|
|
# upload_id :bigint
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_post_hotlinked_media_on_post_id_and_url_md5 (post_id, md5((url)::text)) UNIQUE
|
|
#
|