diff --git a/config/initializers/chewy.rb b/config/initializers/chewy.rb index bef2746ec7..702f7516c7 100644 --- a/config/initializers/chewy.rb +++ b/config/initializers/chewy.rb @@ -11,7 +11,8 @@ Chewy.settings = { journal: false, } -Chewy.root_strategy = enabled ? :sidekiq : :bypass +Chewy.root_strategy = enabled ? :sidekiq : :bypass +Chewy.request_strategy = enabled ? :sidekiq : :bypass module Chewy class << self diff --git a/config/initializers/twitter_regex.rb b/config/initializers/twitter_regex.rb index e924fac228..7fa828300b 100644 --- a/config/initializers/twitter_regex.rb +++ b/config/initializers/twitter_regex.rb @@ -2,7 +2,7 @@ module Twitter class Regex REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}\(\)\?]/iou - REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*';:=\,\.\$%\[\]\p{Pd}~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou + REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*';:=\,\.\$%\[\]~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou REGEXEN[:valid_url_balanced_parens] = / \( (?: diff --git a/spec/services/fetch_link_card_service_spec.rb b/spec/services/fetch_link_card_service_spec.rb index ba61d22c34..edacc4425c 100644 --- a/spec/services/fetch_link_card_service_spec.rb +++ b/spec/services/fetch_link_card_service_spec.rb @@ -15,6 +15,8 @@ RSpec.describe FetchLinkCardService do stub_request(:head, 'http://example.com/日本語').to_return(status: 200, headers: { 'Content-Type' => 'text/html' }) stub_request(:get, 'http://example.com/日本語').to_return(request_fixture('sjis.txt')) stub_request(:head, 'https://github.com/qbi/WannaCry').to_return(status: 404) + stub_request(:head, 'http://example.com/test-').to_return(status: 200, headers: { 'Content-Type' => 'text/html' }) + stub_request(:get, 'http://example.com/test-').to_return(request_fixture('idn.txt')) subject.call(status) end @@ -63,6 +65,14 @@ RSpec.describe FetchLinkCardService do expect(status.preview_cards.first.title).to eq("SJISのページ") end end + + context do + let(:status) { Fabricate(:status, text: 'test http://example.com/test-') } + + it 'works with a URL ending with a hyphen' do + expect(a_request(:get, 'http://example.com/test-')).to have_been_made.at_least_once + end + end end context 'in a remote status' do