Support UTF-8 Characters in Domains During CSV Import (#20592)
* Support UTF-8 Characters in Domains During Import * Update Changelong
This commit is contained in:
parent
9d039209cc
commit
147d8bd8fc
4 changed files with 26 additions and 1 deletions
|
@ -185,6 +185,7 @@ Some of the features in this release have been funded through the [NGI0 Discover
|
||||||
- Fix `CDN_HOST` not being used in some asset URLs ([tribela](https://github.com/mastodon/mastodon/pull/18662))
|
- Fix `CDN_HOST` not being used in some asset URLs ([tribela](https://github.com/mastodon/mastodon/pull/18662))
|
||||||
- Fix `CAS_DISPLAY_NAME`, `SAML_DISPLAY_NAME` and `OIDC_DISPLAY_NAME` being ignored ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18568))
|
- Fix `CAS_DISPLAY_NAME`, `SAML_DISPLAY_NAME` and `OIDC_DISPLAY_NAME` being ignored ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18568))
|
||||||
- Fix various typos in comments throughout the codebase ([luzpaz](https://github.com/mastodon/mastodon/pull/18604))
|
- Fix various typos in comments throughout the codebase ([luzpaz](https://github.com/mastodon/mastodon/pull/18604))
|
||||||
|
- Fix CSV upload no longer breaks if an server domain includes UTF-8 characters ([HamptonMakes]())
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ class ImportService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def import_data
|
def import_data
|
||||||
Paperclip.io_adapters.for(@import.data).read
|
Paperclip.io_adapters.for(@import.data).read.force_encoding(Encoding::UTF_8)
|
||||||
end
|
end
|
||||||
|
|
||||||
def relations_map_for_account(account, account_ids)
|
def relations_map_for_account(account, account_ids)
|
||||||
|
|
1
spec/fixtures/files/utf8-followers.txt
vendored
Normal file
1
spec/fixtures/files/utf8-followers.txt
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
@nare@թութ.հայ
|
|
@ -172,6 +172,29 @@ RSpec.describe ImportService, type: :service do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Based on the bug report 20571 where UTF-8 encoded domains were rejecting import of their users
|
||||||
|
#
|
||||||
|
# https://github.com/mastodon/mastodon/issues/20571
|
||||||
|
context 'utf-8 encoded domains' do
|
||||||
|
subject { ImportService.new }
|
||||||
|
|
||||||
|
let!(:nare) { Fabricate(:account, username: 'nare', domain: 'թութ.հայ', locked: false, protocol: :activitypub, inbox_url: 'https://թութ.հայ/inbox') }
|
||||||
|
|
||||||
|
# Make sure to not actually go to the remote server
|
||||||
|
before do
|
||||||
|
stub_request(:post, "https://թութ.հայ/inbox").to_return(status: 200)
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:csv) { attachment_fixture('utf8-followers.txt') }
|
||||||
|
let(:import) { Import.create(account: account, type: 'following', data: csv) }
|
||||||
|
|
||||||
|
it 'follows the listed account' do
|
||||||
|
expect(account.follow_requests.count).to eq 0
|
||||||
|
subject.call(import)
|
||||||
|
expect(account.follow_requests.count).to eq 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'import bookmarks' do
|
context 'import bookmarks' do
|
||||||
subject { ImportService.new }
|
subject { ImportService.new }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue