fix(export): don't fail when trying to write a file name > 255 bytes

This commit is contained in:
Colin Darie 2023-05-04 12:45:58 +02:00
parent 53b7a37fb4
commit f615facbba
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
2 changed files with 23 additions and 1 deletions

View file

@ -40,5 +40,16 @@ describe DownloadManager::ParallelDownloadQueue do
# expect(downloadable_manager.errors).to have_key(destination)
end
end
context 'with a destination filename too long' do
let(:destination) { 'a' * 252 + '.txt' }
it 'limit the file path to 255 bytes' do
target = File.join(download_to_dir, 'a' * 251 + '.txt')
expect { subject }.to change { File.exist?(target) }
attachment.file.rewind
expect(attachment.file.read).to eq(File.read(target))
end
end
end
end