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

Display Share Expiry Based on UTC Time #47176

Open
4 tasks done
alperozturk96 opened this issue Aug 12, 2024 · 5 comments
Open
4 tasks done

Display Share Expiry Based on UTC Time #47176

alperozturk96 opened this issue Aug 12, 2024 · 5 comments

Comments

@alperozturk96
Copy link

alperozturk96 commented Aug 12, 2024

⚠️ This issue respects the following points: ⚠️

Bug description

When user set the share expiration time, it's not expiring based on user's locale.

I shared a file at 26.07.2024 10:21 and set the expiration date to 29.07.2024 10:21. Default time, log time zone is Europe/Berlin. Server time is UTC. Locale is German. Language is English (US). Nextcloud version is v29.0.4.

29.07.2024 10:21 didn't expire.

OC_SHARE table

[
   {
       "accepted": 0,
       "attributes": null,
       "expiration": null,
       "file_source": 391,
       "file_target": "/black.jpeg",
       "hide_download": 0,
       "id": 1,
       "item_source": "391",
       "item_target": null,
       "item_type": "file",
       "label": "",
       "mail_send": 0,
       "note": null,
       "parent": null,
       "password": null,
       "password_by_talk": 0,
       "password_expiration_time": null,
       "permissions": 17,
       "share_name": null,
       "share_type": 3,
       "share_with": null,
       "stime": 1721982057,
       "token": "xGByxARNYoF42S5",
       "uid_initiator": "admin",
       "uid_owner": "admin"
   }
]

Details

"expiration" is null in OC_Share table however I set the expiration date.

Maybe these questions can help

  1. Why expiration is null in oc_share table when even user set the expiration date?
  2. Is expiration date calculation based on default_timezone or server time (always UTC)?
  3. For example, what will happen when user in GMT-3 and set expiration date exactly one day later for same hour for user in GMT+3? Is it going to expire one day later in GMT-3 or GMT+3 or UTC?

Possible Solution

We can hold in DB the timezone difference between UTC and timezone of the shared user and calculate the diff and expire in correct time zone. Therefore, we will not rely on the user's timezone, we will rely on the difference between server time and the timezone of the shared user.

Steps to reproduce

  1. Share file with expiration time
  2. Set user default time zone

Expected behavior

Share expiration time must be based on user's locale.

Nextcloud Server version

29.0.4

@alperozturk96 alperozturk96 added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Aug 12, 2024
@susnux
Copy link
Contributor

susnux commented Aug 13, 2024

I think the expected behavior is to have the time in the users timezone that created the setting.
If I am in UTC+1 and set it to 12:30, then a user in UTC+2 will see the expiring at 13:30 local time.

@alperozturk96
Copy link
Author

alperozturk96 commented Aug 13, 2024

I think the expected behavior is to have the time in the users timezone that created the setting. If I am in UTC+1 and set it to 12:30, then a user in UTC+2 will see the expiring at 13:30 local time.

Exactly. We should expire based on the shared user's time zone, not the sharer's or the server's time zone.

@skjnldsv
Copy link
Member

skjnldsv commented Aug 13, 2024

I think that would be an enhancement.
It could be nice, but we need to discuss this.

The most important part is properly displaying how long before the share expires. We could do this with the new public sharing UI for 31 🤔

Just so you know, we already use the owner timezone (26.0.13, 27.1.8, 28.0.4 and 29.0.0)
#43428

TODO

  • Show timezone in public sharing
  • Show timezone/time left in Files UI
  • Show timezone in File request creation dialog

@skjnldsv skjnldsv added enhancement and removed bug labels Aug 13, 2024
@sorbaugh sorbaugh changed the title [Bug]: Determining Share Expiry Based on UTC Time Determining Share Expiry Based on UTC Time Aug 14, 2024
@artonge
Copy link
Contributor

artonge commented Aug 20, 2024

I was not able to reproduce. expiration in oc_share is populated with the correct expiration date, and take into account the user timezone.

If you can reproduce on latest master, please reopen with reproduction steps.

@artonge artonge closed this as completed Aug 20, 2024
@skjnldsv skjnldsv reopened this Aug 20, 2024
@skjnldsv
Copy link
Member

Keeping opened because my TODO still stands :)

@skjnldsv skjnldsv added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Aug 20, 2024
@sorbaugh sorbaugh added this to the Nextcloud 31 milestone Oct 2, 2024
@sorbaugh sorbaugh changed the title Determining Share Expiry Based on UTC Time Display Share Expiry Based on UTC Time Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📄 To do (~10 entries)
Development

No branches or pull requests

7 participants