Conversation
src/util.rs
Outdated
| tm.to_offset(time::UtcOffset::try_current_local_offset().unwrap()) | ||
| }, | ||
| Err(_) => time::OffsetDateTime::unix_epoch().to_offset(time::offset!(UTC)), | ||
| Err(_) => time::OffsetDateTime::unix_epoch().to_offset(time::UtcOffset::try_current_local_offset().unwrap()), |
There was a problem hiding this comment.
These changes break webdav on Linux. The unwrap() on try_current_local_offset() always fails with error::IndeterminateOffset.
Tested on both an x86_64 PC and a ARMv7 device. Both had a timezone (at least/etc/localtime) specified.
It seems this issue was already discussed in time-rs/time#296 . I only skimmed that, but it seems to have been introduced a few versions before the used time crate here. There were mentions of vulnerabilities related to it and it seems that current version, don't have this method anymore.
There was a problem hiding this comment.
I didn't handle the error situation for the machine without the timezone setting.
I modified the unwrap() function to the unwrap_or() function.
There was a problem hiding this comment.
It's weird since I had a timezone set on my machines. The chrono crate (not time) picks the timezone up fine.
Commit 6b98eea resolved the issue.
This is likely just due to the particular version of time. If it is updated, this will need to be fixed to the proper way the crate does it anyway. But seems current dependencies don't favour bumping the version.
Detailed to the author of the pr here: miquels#7 (comment)
|
That commit is a great fix indeed. Seems to continue working flawlessly on Linux as well now. 👍 |
It was modified to work with Windows OS.