Skip to content

fix(Streamer): use localtime for ZIP files - #54402

Merged
susnux merged 2 commits into
masterfrom
fix/streamer-mtime-zip
Aug 18, 2025
Merged

fix(Streamer): use localtime for ZIP files#54402
susnux merged 2 commits into
masterfrom
fix/streamer-mtime-zip

Conversation

@susnux

@susnuxsusnux commented Aug 13, 2025

Copy link
Copy Markdown
Contributor

Summary

ZIP does not use a proper timestamp but uses something called "DOS time".
This is a weird old format with some limitations like accuracy of only
2 seconds, but also no timezone information.
Also unlike UNIX time it is not relative to some specific point in time
with timezone information, but is always considered to be the local
time. Meaning we need to convert it first to the users local time.

Checklist

@susnuxsusnux added this to the Nextcloud 32 milestone Aug 13, 2025
@susnuxsusnux added bug 3. to review Waiting for reviews labels Aug 13, 2025
@joshtrichardsjoshtrichards added the hotspot: file time handling ctime, mtime, etc. handling during various operations label Aug 13, 2025
Base automatically changed from fix/streamer-directory-mtime to masterAugust 13, 2025 15:58
@susnux
susnux marked this pull request as ready for review August 13, 2025 16:07
@susnux
susnux requested a review from a team as a code ownerAugust 13, 2025 16:07
@susnux
susnux requested review from come-nc, icewind1991 and sorbaugh and removed request for a teamAugust 13, 2025 16:07
@susnux
susnuxforce-pushed the fix/streamer-mtime-zip branch from 0b489d8 to 7428b5bCompareAugust 13, 2025 16:07
@susnux

Copy link
Copy Markdown
ContributorAuthor

/backport to stable31

Comment threadlib/private/Streamer.php Outdated
@susnux
susnuxforce-pushed the fix/streamer-mtime-zip branch from 7428b5b to 6f0e0deCompareAugust 14, 2025 08:02
ZIP does not use a proper timestamp but uses something called "DOS time".
This is a weird old format with some limitations like accuracy of only
2 seconds, but also no timezone information.
Also unline UNIX time it is not relative to some specific point in time
with timezone information, but is always considered to be the local
time. Meaning we need to convert it first to the users local time.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
susnuxforce-pushed the fix/streamer-mtime-zip branch from 6f0e0de to ba00416CompareAugust 14, 2025 15:19

@come-nccome-nc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That means users A and B downloading the same zip content will get different time information in there? So if I download stuff and then send it to someone on another time zone times will look wrong on their computer?

@susnux

Copy link
Copy Markdown
ContributorAuthor

That means users A and B downloading the same zip content will get different time information in there? So if I download stuff and then send it to someone on another time zone times will look wrong on their computer?

Yes and there is no fix - ZIP time is considered the local time of the user that created it.
You should rather use the TAR download ;)

@susnux
susnux merged commit cd550d5 into masterAug 18, 2025
212 of 217 checks passed
@susnux
susnux deleted the fix/streamer-mtime-zip branch August 18, 2025 12:39
@skjnldsvskjnldsv mentioned this pull request Aug 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbughotspot: file time handlingctime, mtime, etc. handling during various operations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Time get the wrong timezone when downloaded as zip

6 participants

@susnux@icewind1991@AndyScherzinger@come-nc@joshtrichards@skjnldsv