Skip to content

fix: On Xiaomi phone, lastModified is wrong so we fallback on the current time#2017

Open
tevincent wants to merge 3 commits intomainfrom
fix-last-modified
Open

fix: On Xiaomi phone, lastModified is wrong so we fallback on the current time#2017
tevincent wants to merge 3 commits intomainfrom
fix-last-modified

Conversation

@tevincent
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 1, 2026 12:16
@tevincent tevincent enabled auto-merge May 1, 2026 12:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to mitigate incorrect lastModified timestamps on (some) Xiaomi devices by clamping future-dated timestamps back to “now”, and then using that value when building upload requests / paths.

Changes:

  • Introduces UploadFile.getLastModified() to clamp fileModifiedAt when it’s in the future.
  • Uses the new clamped value for dated subfolder creation and for upload request parameters.
  • Updates the Sentry skip condition for ACTION_OPEN_DOCUMENT errors to use the new last-modified accessor.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
app/src/main/java/com/infomaniak/drive/data/services/UploadWorker.kt Uses the new last-modified accessor in the Sentry ignore condition.
app/src/main/java/com/infomaniak/drive/data/models/UploadFile.kt Adds getLastModified() and uses it to build dated subfolders.
app/src/main/java/com/infomaniak/drive/data/api/UploadTask.kt Uses the new last-modified accessor for direct uploads and upload sessions.
app/src/main/java/com/infomaniak/drive/data/api/ApiRepository.kt Uses the new last-modified accessor for empty-file direct uploads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/java/com/infomaniak/drive/data/api/UploadTask.kt
Comment thread app/src/main/java/com/infomaniak/drive/data/api/ApiRepository.kt
Comment thread app/src/main/java/com/infomaniak/drive/data/models/UploadFile.kt
Comment thread app/src/main/java/com/infomaniak/drive/data/models/UploadFile.kt
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/java/com/infomaniak/drive/data/api/UploadTask.kt Outdated
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

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.

2 participants