fix(export): sanitize filename containing unsafe chars for storage
Pourrait fixer des problèmes de dezip sous windows de zip.
This commit is contained in:
parent
f615facbba
commit
5be8865675
2 changed files with 33 additions and 8 deletions
|
@ -51,5 +51,27 @@ describe DownloadManager::ParallelDownloadQueue do
|
|||
expect(attachment.file.read).to eq(File.read(target))
|
||||
end
|
||||
end
|
||||
|
||||
context 'with filename containing unsafe characters for storage' do
|
||||
let(:destination) { "file:éà\u{202e} K.txt" }
|
||||
|
||||
it 'sanitize the problematic chars' do
|
||||
target = File.join(download_to_dir, 'file-éà- K.txt')
|
||||
expect { subject }.to change { File.exist?(target) }
|
||||
attachment.file.rewind
|
||||
expect(attachment.file.read).to eq(File.read(target))
|
||||
end
|
||||
|
||||
context 'with a destination tree' do
|
||||
let(:destination) { 'subdir/file.txt' }
|
||||
|
||||
it 'preserves the destination tree' do
|
||||
target = File.join(download_to_dir, 'subdir/file.txt')
|
||||
expect { subject }.to change { File.exist?(target) }
|
||||
attachment.file.rewind
|
||||
expect(attachment.file.read).to eq(File.read(target))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue