Fix for UTF8 filename issues (#12)

This commit is contained in:
Milos Stojanovic
2019-09-05 13:59:20 +02:00
parent 3182ed058a
commit 2ea77cc88e
7 changed files with 69 additions and 13 deletions

View File

@@ -156,7 +156,21 @@ class FilesTest extends TestCase
touch(TEST_REPOSITORY.'/john/john.txt', $this->timestamp);
$path_encoded = base64_encode('john.txt');
$this->sendRequest('GET', '/download/'.$path_encoded);
$this->sendRequest('GET', '/download&path='.$path_encoded);
$this->assertOk();
}
public function testDownloadUTF8File()
{
$username = 'john@example.com';
$this->signIn($username, 'john123');
mkdir(TEST_REPOSITORY.'/john');
touch(TEST_REPOSITORY.'/john/ąčęėįšųū.txt', $this->timestamp);
$path_encoded = base64_encode('/ąčęėįšųū.txt');
$this->sendRequest('GET', '/download&path='.$path_encoded);
$this->assertOk();
}
@@ -166,7 +180,7 @@ class FilesTest extends TestCase
touch(TEST_REPOSITORY.'/test.txt', $this->timestamp);
$path_encoded = base64_encode('test.txt');
$this->sendRequest('GET', '/download/'.$path_encoded);
$this->sendRequest('GET', '/download&path='.$path_encoded);
$this->assertStatus(404);
}
@@ -181,7 +195,7 @@ class FilesTest extends TestCase
touch(TEST_REPOSITORY.'/jane/jane.txt', $this->timestamp);
$path_encoded = base64_encode('jane.txt');
$this->sendRequest('GET', '/download/'.$path_encoded);
$this->sendRequest('GET', '/download&path='.$path_encoded);
$this->assertStatus(404);
}
@@ -192,7 +206,7 @@ class FilesTest extends TestCase
$this->signIn($username, 'john123');
$path_encoded = base64_encode('missing.txt');
$this->sendRequest('GET', '/download/'.$path_encoded);
$this->sendRequest('GET', '/download&path='.$path_encoded);
$this->assertStatus(302);
}