Skip to content

Stray share entries in DB after deleting parent folder #14664

Closed

Description

@PVince81

Steps to reproduce

  1. Create a folder "test"
  2. Create/upload a file "test/file.txt"
  3. Share "test/file.txt" with link
  4. Delete "test"
  5. Check "oc_shares"

Expected result

The share entry is gone.

Actual result

The share entry still exists.
Also, the link share can still be opened and shows a page with an empty file or folder!

Versions

ownCloud 6 (stable6)
ownCloud 7 (stable7)
ownCloud 8 (stable8)
master

@schiesbn I vaguely remember that there were technical issues (maybe performance) if we want to properly delete all shares

Activity

  1. PVince81 commented on Mar 3, 2015

    @PVince81
    ContributorAuthor

    Workaround would be to run this #12323 after a deletion (or on a regular basis).

    But the other bug is that the link share doesn't give 404 directly.

  2. wshadow commented on Mar 3, 2015

    @wshadow

    Another case for Foreign keys? #13143

  3. PVince81 commented on Mar 3, 2015

    @PVince81
    ContributorAuthor

    Yeah...

    CC @DeepDiver1975

  4. added this to the milestone on Mar 3, 2015
  5. PVince81 commented on Mar 3, 2015

    @PVince81
    ContributorAuthor

    Setting to 8.1 to keep this in mind...

  6. PVince81 commented on Mar 3, 2015

    @PVince81
    ContributorAuthor

    @jnfrmarks another test case. Can probably be verified by checking that the created link share does not exist any more after deleting the parent folder. (currently if you query it with the OCS Share API you'll see that it still exist)

  7. PVince81 commented on Mar 3, 2015

    @PVince81
    ContributorAuthor

    It looks like shares set directly on the deleted item (file/folder) is deleted here: https://github.com/owncloud/core/blob/master/apps/files_sharing/lib/updater.php#L89

    Maybe that code needs to be extended to also do the same for all children.
    That's the place where I miss something like "SELECT fileid FROM children" ...

  8. PVince81 commented on Mar 3, 2015

    @PVince81
    ContributorAuthor

    I guess a 8.1 scoped solution would be to trigger a background job to delete all orphaned shares (not only the currently deleted one).
    The query itself can be expensive in case of many orphaned entries with SQLite since we cannot use DELETE + LEFT JOIN (like MySQL allows), so better put it in a background job.

  9. PVince81 commented on Mar 23, 2015

    @PVince81
    ContributorAuthor

    Duplicate of #6985

  10. locked as resolved and limited conversation to collaborators on Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions