Guillermo - Issue #20
This commit is contained in:
parent
3b102b3903
commit
91c3b4f396
|
@ -33,7 +33,7 @@ class FileUploader extends FileManager {
|
|||
private function setNewName($fileName) {
|
||||
$newName = $fileName;
|
||||
$newName = strtolower($newName);
|
||||
$newName = preg_replace('/\s+/', '_', $newName);
|
||||
$newName = preg_replace('/[^a-zA-Z0-9\d\.\-]/', '_', $newName);
|
||||
|
||||
if ($this->linearCongruentialGenerator instanceof LinearCongruentialGenerator) {
|
||||
$newName = $this->linearCongruentialGenerator->generate($this->linearCongruentialGeneratorOffset) . '_' . $newName;
|
||||
|
|
|
@ -3,7 +3,7 @@ describe 'File Upload and Download' do
|
|||
Scripts.login('creator@os4.com', 'creator')
|
||||
|
||||
it 'should upload file when creating ticket' do
|
||||
file = File.new('../server/files/upload.txt', 'w+')
|
||||
file = File.new('../server/files/upload(3).txt', 'w+')
|
||||
file.puts('file content')
|
||||
file.close
|
||||
|
||||
|
@ -14,13 +14,13 @@ describe 'File Upload and Download' do
|
|||
'content' => 'this is a ticket that contains a file',
|
||||
'language' => 'en',
|
||||
'departmentId' => 1,
|
||||
'file' => File.open( "../server/files/upload.txt")
|
||||
'file' => File.open( "../server/files/upload(3).txt")
|
||||
})
|
||||
(result['status']).should.equal('success')
|
||||
|
||||
ticket = $database.getLastRow('ticket')
|
||||
|
||||
(ticket['file'].include? 'upload.txt').should.equal(true)
|
||||
(ticket['file'].include? 'upload_3_.txt').should.equal(true)
|
||||
(File.exist? ('../server/files/' + ticket['file'])).should.equal(true)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue