aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Connector/Sabre/FileTest.php
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2021-12-06 15:17:08 +0100
committerJohn Molakvoæ <skjnldsv@protonmail.com>2021-12-07 09:40:23 +0100
commit5223b0b6112defe682aafcddeda951b5461c95c8 (patch)
tree75a286a12f01e1130ce3d793416817a1a4a92ea3 /apps/dav/tests/unit/Connector/Sabre/FileTest.php
parent4ed014ca86892498c585cf28603c768db86b7e71 (diff)
downloadnextcloud-server-5223b0b6112defe682aafcddeda951b5461c95c8.tar.gz
nextcloud-server-5223b0b6112defe682aafcddeda951b5461c95c8.zip
Prevent writing invalid mtime
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre/FileTest.php')
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php24
1 files changed, 11 insertions, 13 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index 304e8abed07..3e6a47d5854 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -361,28 +361,28 @@ class FileTest extends TestCase {
'expected result' => null
],
"castable string (int)" => [
- 'HTTP_X_OC_MTIME' => "34",
- 'expected result' => 34
+ 'HTTP_X_OC_MTIME' => "987654321",
+ 'expected result' => 987654321
],
"castable string (float)" => [
- 'HTTP_X_OC_MTIME' => "34.56",
- 'expected result' => 34
+ 'HTTP_X_OC_MTIME' => "123456789.56",
+ 'expected result' => 123456789
],
"float" => [
- 'HTTP_X_OC_MTIME' => 34.56,
- 'expected result' => 34
+ 'HTTP_X_OC_MTIME' => 123456789.56,
+ 'expected result' => 123456789
],
"zero" => [
'HTTP_X_OC_MTIME' => 0,
- 'expected result' => 0
+ 'expected result' => null
],
"zero string" => [
'HTTP_X_OC_MTIME' => "0",
- 'expected result' => 0
+ 'expected result' => null
],
"negative zero string" => [
'HTTP_X_OC_MTIME' => "-0",
- 'expected result' => 0
+ 'expected result' => null
],
"string starting with number following by char" => [
'HTTP_X_OC_MTIME' => "2345asdf",
@@ -398,11 +398,11 @@ class FileTest extends TestCase {
],
"negative int" => [
'HTTP_X_OC_MTIME' => -34,
- 'expected result' => -34
+ 'expected result' => null
],
"negative float" => [
'HTTP_X_OC_MTIME' => -34.43,
- 'expected result' => -34
+ 'expected result' => null
],
];
}
@@ -421,7 +421,6 @@ class FileTest extends TestCase {
if ($resultMtime === null) {
$this->expectException(\InvalidArgumentException::class);
- $this->expectExceptionMessage("X-OC-MTime header must be an integer (unix timestamp).");
}
$this->doPut($file, null, $request);
@@ -447,7 +446,6 @@ class FileTest extends TestCase {
if ($resultMtime === null) {
$this->expectException(\Sabre\DAV\Exception::class);
- $this->expectExceptionMessage("X-OC-MTime header must be an integer (unix timestamp).");
}
$this->doPut($file.'-chunking-12345-2-0', null, $request);