Permalink
Browse files

Merge remote-tracking branch 'origin/stable' into pkgr

  • Loading branch information...
crohr committed Jan 11, 2018
2 parents 5690d25 + b9bc27e commit 298ed7eeb8c7dbe429c35e5f1f85356f582e7136
@@ -70,7 +70,7 @@ def show
send_file backup.path
else
if @error
render layout: 'no_ember', status: 422
render template: 'admin/backups/show.html.erb', layout: 'no_ember', status: 422
else
render body: nil, status: 404
end
@@ -504,8 +504,8 @@ def password_reset
success: false,
message: @error,
errors: @user&.errors&.to_hash,
is_developer: UsernameCheckerService.is_developer?(@user.email),
admin: @user.admin?
is_developer: UsernameCheckerService.is_developer?(@user&.email),
admin: @user&.admin?
}
else
render json: {
View
@@ -1273,7 +1273,7 @@ def pm_with_non_human_user?
end
def featured_link_root_domain
MiniSuffix.domain(URI.parse(self.featured_link).hostname)
MiniSuffix.domain(URI.parse(URI.encode(self.featured_link)).hostname)
end
private
@@ -182,8 +182,8 @@ def self.absolutize_urls(url, contents)
end
def self.topic_id_for_embed(embed_url)
embed_url = normalize_url(embed_url)
TopicEmbed.where("lower(embed_url) = ?", embed_url).pluck(:topic_id).first
embed_url = normalize_url(embed_url).sub(/^https?\:\/\//, '')
TopicEmbed.where("embed_url ~* '^https?://#{embed_url}$'").pluck(:topic_id).first
end
def self.first_paragraph_from(html)
@@ -237,7 +237,8 @@ def get_size(url)
return unless SiteSetting.crawl_images? || Discourse.store.has_been_uploaded?(url)
@size_cache[url] = FastImage.size(absolute_url)
rescue Zlib::BufError # FastImage.size raises BufError for some gifs
rescue Zlib::BufError, URI::InvalidURIError, URI::InvalidComponentError
# FastImage.size raises BufError for some gifs, leave it.
end
def is_valid_image_url?(url)
View
@@ -5754,7 +5754,7 @@
},
{
"code": "1f92b",
"name": "sushing_face"
"name": "shushing_face"
},
{
"code": "1f92d",
View
@@ -325,7 +325,7 @@
"diversity": false
},
{
"name": "sushing_face",
"name": "shushing_face",
"diversity": false
},
{
View
@@ -4,7 +4,7 @@ module Discourse
module VERSION #:nodoc:
MAJOR = 1
MINOR = 9
TINY = 0
TINY = 1
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
@@ -303,11 +303,9 @@
context 'invalid token' do
render_views
before do
it 'disallows login' do
get :password_reset, params: { token: "evil_trout!" }
end
it 'disallows login' do
expect(response).to be_success
expect(CGI.unescapeHTML(response.body))
@@ -319,6 +317,16 @@
expect(session[:current_user_id]).to be_blank
end
it "responds with proper error message" do
put :password_reset, params: {
token: "evil_trout!", password: "awesomeSecretPassword"
}, format: :json
expect(response).to be_success
expect(JSON.parse(response.body)["message"]).to eq(I18n.t('password_reset.no_token'))
expect(session[:current_user_id]).to be_blank
end
end
context 'valid token' do
@@ -60,6 +60,20 @@
end
context '.topic_id_for_embed' do
it "returns correct topic id irrespective of url protocol" do
topic_embed = Fabricate(:topic_embed, embed_url: "http://example.com/post/248")
expect(TopicEmbed.topic_id_for_embed('http://exAMPle.com/post/248')).to eq(topic_embed.topic_id)
expect(TopicEmbed.topic_id_for_embed('https://example.com/post/248/')).to eq(topic_embed.topic_id)
expect(TopicEmbed.topic_id_for_embed('http://example.com/post/248/2')).to eq(nil)
expect(TopicEmbed.topic_id_for_embed('http://examples.com/post/248')).to eq(nil)
expect(TopicEmbed.topic_id_for_embed('http://example.com/post/24')).to eq(nil)
expect(TopicEmbed.topic_id_for_embed('http://example.com/post')).to eq(nil)
end
end
describe '.find_remote' do
context ".title_scrub" do
@@ -2101,6 +2101,7 @@ def build_topic_with_title(title)
"https://meta.discourse.org",
"https://meta.discourse.org/",
"https://meta.discourse.org/?filter=test",
"https://meta.discourse.org/t/中國/1",
].each do |featured_link|
it "should extract the root domain from #{featured_link} correctly" do
topic.featured_link = featured_link
@@ -4,6 +4,7 @@
let(:host) { "eviltrout.com" }
let(:embed_url) { "http://eviltrout.com/2013/02/10/why-discourse-uses-emberjs.html" }
let(:embed_url_secure) { "https://eviltrout.com/2013/02/10/why-discourse-uses-emberjs.html" }
let(:discourse_username) { "eviltrout" }
it "is 404 without an embed_url" do
@@ -95,7 +96,7 @@
it "displays the right view" do
topic_embed = Fabricate(:topic_embed, embed_url: embed_url)
get '/embed/comments', params: { embed_url: embed_url }, headers: headers
get '/embed/comments', params: { embed_url: embed_url_secure }, headers: headers
expect(response.body).to match(I18n.t('embed.start_discussion'))
end

0 comments on commit 298ed7e

Please sign in to comment.