[5.0.11RC1] Share link -- expiration date was set to past date -- link still valid
Expected behavior Link is expired
Actual behavior Link is accessible. ownCloud shows the file as “Shared”. Under shared tab, ownCloud seems to be unshared.
Steps to reproduce
- Share a file via a link
- Set an expiration date – by accident (on purpose) set it to an already expired date as below (current date is 8/29/13).

- In another browser (simulating a different user), go to the link. Notice it is available even though it should be expired:

Files can be viewed and downloaded. 4. Go back to ownCloud web page. Top level on files shows it is shared. However, when you select “share” there are no users listed and the “Share as Link” is not checked:

- At this point, go back to the link and it has expired.
SUGGESTIONS:
- Gray out all dates prior to the current date so a user cannot accidently select a previous date
- Make sure the link is expired if the expiration date is passed
{"installed":"true","version":"5.0.15","versionstring":"5.0.11RC1"} Ubuntu apache Internet Explorer 9, Google Chrome, Mozilla firefox
It could be that shares are only deleted via cron.php. Access cron.php first and try it then again.
@bantu free resources left on your side to take a look? THX @karlitschek who else could have a look?
@schiesbn
Can take a look tomorrow. Feel free to assign to me.
This is at least partially an issue with UI, namely the lack of feedback (whether the operation has succeeded or not). @owncloud/designers
@shoeper Clearing expired shares via cron probably makes sense, but not checking the expiration date when a file is accessed does not. So I think/hope/expect expires are not only handled by cron.
@shoeper Actually, on closer inspection, you may be entirely correct. Taking a deeper look.
Another issue related to this report: OCP\Share::getShareByToken($token); returns share data for expired shares. I think it shouldn't. What do you think? @karlitschek @DeepDiver1975
To summarise, at least three things need to be addressed here:
- An expired share should not be accessible regardless of (cron) garbage collection.
- When setting an expiration date that is in the past and the file is no longer shared with anyone, the "Shared" icon should be gone.
- Lack of feedback for all non-first share operations (e.g. adding an expiration date or password to an existing share). (The "Shared" appears after the initial share, so there is some feedback for the first operation.)
Also cc @schiesbn
I didn't had a look at the code. But a general idea:
I would suggest to check the expire date every time a share gets accesses (e.g. someone opens a public link, someone opens his /Shared folder and we collect the file list, someone opens a random folder and we check the share status to display the icons). If the share is expired we remove it from the database and doesn't return the content, doesn't include it in the files-list for the accessed Shared folder or doesn't add the share icon. This way we make sure that nobody will be able to access a expired share, the icons will be always up-to-date and that the database will be cleaned-up in a adequate time frame without the need of a cron.
Regarding the date-picker, it would be nice to grey out dates in the past. But afaik we use a third-party date-picker so I'm not sure if this can be done easily. If we just silently remove the share if the user chooses a expire date in the past this could be quite irritating, because the user maybe doesn't even know that he had choose a date in the past by accident.
For me that doesn't make any sense. Think of a company using owncloud. 100 people using the cloud all day. At the moment the shares are checked as often as the cronjob runs. Then every share in a certain folder will be checked every time the page is accessed. That will slow down the whole server and leads to millions of useless sql queries. I think it should just be added that a share won't be accessible after the expire date. Performance should always beeing kept in mind.
In case of the date picker I agree with you.
100 people using the cloud all day. At the moment the shares are checked as often as the cronjob runs.
I don't understand it. Afaik the current implementation doesn't use cronjobs to check any shares.
I think it should just be added that a share won't be accessible after the expire date. Performance should always beeing kept in mind.
This check is exactly what I suggest. All the operations I mention above already perform a db query. To check if we need to set the "shared"-icon we need to query the db, to list the /Shared folder we need to query the db to get the correct file-list and to display a public share we also query the db to verify the token.
All this query can already return the timestamp in the result array without any additional queries. The only think which we would add is a a comparison of two integers to see if the share is still accessible or not. If not we delete the share from the db to clean-up the database. I don't see a performance issue here.
Yes, ok I'm sorry. I just forgot that the shared icon is still permanently displayed when the file is being shared.
Expiration seems to solely happen in the (380 lines) method getItems() (see https://github.com/owncloud/core/blob/master/lib/public/share.php#L828). If an expired item is accessed, the table entry is deleted and execution continues without the affected entry (see https://github.com/owncloud/core/blob/master/lib/public/share.php#L1092).
The getItems() method is however never used when files are downloaded when a token is involved (i.e. when share is of type SHARE_TYPE_LINK). The method getShareByToken() is used which does not check expiration (see https://github.com/owncloud/core/blob/master/apps/files_sharing/public.php#L22 and https://github.com/owncloud/core/blob/master/lib/public/share.php#L285).
@bantu This is fixed for me in master. I didn't read the whole conversation. Please reopen if this is still an issue.
@kabum Please stop closing tickets that are assigned to me. I very much doubt all three points of https://github.com/owncloud/core/issues/4649#issuecomment-23629193 have been addressed and I am not going to verify whether that is the case or not right now.
@bantu Sorry...thought that this is an forgotten issue.
Any update on this ?
@bantu any update on this ?