Uh oh!
There was an error while loading. Please reload this page.
Fix timestamp detection on external FTP - #33203
Conversation
kesselb
commented
Jul 11, 2022
Hi, can you provide some details? ;) |
guijusto
commented
Jul 12, 2022
I can rollback to the original FTP.php and provide some additional logs if you need it. The solution worked great after the modification on the line 358. The error was something like “Call to a member function getTimestamp() on bool”. |
kesselb
commented
Jul 12, 2022
Hey @guijusto 👋 Thanks. I think it's good to know what kind of date is the problem here. Index: apps/files_external/lib/Lib/Storage/FTP.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php--- a/apps/files_external/lib/Lib/Storage/FTP.php (revision c20d34b2caf6ef030ef52e87311ac96d3fa46931)+++ b/apps/files_external/lib/Lib/Storage/FTP.php (date 1657660464136)@@ -355,8 +355,13 @@
$data = [];
$data['mimetype'] = $isDir ? FileInfo::MIMETYPE_FOLDER : $mimeTypeDetector->detectPath($name);
- $data['mtime'] = \DateTime::createFromFormat('YmdGis', $file['modify'])->getTimestamp();- if ($data['mtime'] === false) {+ $modifyDate = \DateTime::createFromFormat('YmdGis', $file['modify']);+ if ($modifyDate instanceof \DateTime) {+ $data['mtime'] = $modifyDate->getTimestamp();+ } else {+ /** @var \Psr\Log\LoggerInterface $logger */+ $logger = \OC::$server->get(\Psr\Log\LoggerInterface::class);+ $logger->warning('Invalid date. File: ' . $name . ', Date: ' . $file['modify']);
$data['mtime'] = time();
}
if ($isDir) {
Can you patch your system. It should then log the actual file and modify date. |
guijusto
commented
Jul 13, 2022
I'm sorry @kesselb. I was unable to reproduce the error again. I tried your patch, but there was no errors/logs. Then I tried to use the original FTP.php and got no errors too. |
kesselb
commented
Jul 13, 2022
Thanks for trying @guijusto 👍 Index: apps/files_external/lib/Lib/Storage/FTP.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php--- a/apps/files_external/lib/Lib/Storage/FTP.php (revision c20d34b2caf6ef030ef52e87311ac96d3fa46931)+++ b/apps/files_external/lib/Lib/Storage/FTP.php (date 1657699113172)@@ -355,9 +355,11 @@
$data = [];
$data['mimetype'] = $isDir ? FileInfo::MIMETYPE_FOLDER : $mimeTypeDetector->detectPath($name);
- $data['mtime'] = \DateTime::createFromFormat('YmdGis', $file['modify'])->getTimestamp();- if ($data['mtime'] === false) {- $data['mtime'] = time();+ $modifyDate = \DateTime::createFromFormat('YmdGis', $file['modify']);+ if ($modifyDate === false) {+ $date['mtime'] = time();+ } else {+ $data['mtime'] = $modifyDate->getTimestamp();
}
if ($isDir) {
$data['size'] = -1; //unknown@solracsf would you mind to update your pr like above? Fallback code to handle an invalid date is already here but does not work. strtotime also returns false and the typecast would change it to 0 then. |
solracsf
commented
Jul 15, 2022
Done. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
solracsf
commented
Jul 17, 2022
/backport to stable24 |
solracsf
commented
Jul 17, 2022
/backport to stable23 |
solracsf
commented
Jul 17, 2022
/backport to stable22 |
icewind1991
commented
Jul 20, 2022
Do we know what the reported time is that failed to parse? |
szaimen
commented
Nov 13, 2022
However seems like some tests fail @kesselb ? |
f1c7e1b to
b83b33dComparekesselb
commented
Nov 13, 2022
No idea about the S3 related failure 🤷♂️ |
b83b33d to
127283cCompareguijusto
commented
Nov 22, 2022
Hello @kesselb I hope this helps. |
127283c to
34aa816Comparekesselb
commented
Nov 23, 2022
Hi @guijusto, thank you very much 👍
@icewind1991 20220804233459.925 |
kesselb
commented
Nov 23, 2022
I guess .925 is the fraction in milliseconds. It should be possible to add some checks for fraction in milliseconds / fraction in microseconds to avoid this warning. Note the additional |
4bd3b77 to
dc9f850Compareda4d799 to
72de893Comparekesselb
commented
Dec 21, 2022
Hey @guijusto, I just updated the patch. Can you give it a try? Thanks 👍 |
Uh oh!
There was an error while loading. Please reload this page.
Context: #31510 Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
72de893 to
0f9d58dCompare
Hello @kesselb It is FileZilla Server 1.5.1 |
guijusto
commented
Dec 22, 2022
Now it is working as expected. Thanks a lot for working on this @kesselb |

Context: #31510
Fix#31510