Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve file modification timestamps in ZIP archives #326

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

antonta0
Copy link

Hi there,

You seem to be accepting contributions, so I thought I'd go that route instead of support. The commit message describes the problem.

The only downside is that I could not test the change end-to-end due to #322 and I did not want to spend more time on the issue trying to work around that. I'd expected unzip -l on a downloaded archive show timestamps that are displayed in the web UI. All I can say is that according to the client-zip documentation and my quick glance over your codebase that should work. Feel free to change the commit as you see fit.

@horejsek
Copy link
Member

Hello. Thank you for your contribution. This is on the backlog for a long time and your code will help finish it sooner. :-)

@mmso mmso force-pushed the main branch 4 times, most recently from b507a1d to dced0a5 Compare June 28, 2023 09:19
Currently, files in downloaded ZIP archives have current time as a
modification time, even though the modification time is preserved on the
server side when uploading files. That seems like a regression to me,
since a sequence of upload-download effectively erases this metadata,
which is unexpected, inconvenient at best and may result in a complete loss.

I can imagine (1) moving files from some place to ProtonDrive, then (2) moving
these files or some subset of them out of ProtonDrive. No backups from (1) and
erase ProtonDrive's copy at (2) without checking timestamps during the move
results in a loss. If one happened to have backups and ProtonDrive's copy is
earsed, that may be a partial loss if files have been modified in ProtonDrive
between (1) and (2). If ProtonDrive's copy is accessible during or after (2)
and there are no backups from (1) or there were changes in ProtonDrive between
(1) and (2), prepare for manual timestamp mangling which may as well be
infeasible depending on the number of files.

The timestamp is currently set by `client-zip`, where `new Date()` is a default
when input is `ReadableStream<Uint8Array>` and no `lastModified` provided.
Since `fileModifyTime` is already present on a `DecryptedLink`, just pass that
through to `archiveGenerator` and set `lastModified`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants