Skip to content

Public link root reports public-link-item-type "folder" for links to a single file #3693

Open

Description

@AlexAndBear

Describe the bug

For a public link to a single file, the root of the public link reports oc:public-link-item-type = folder (the virtual folder that contains the file). Folder links report folder as well, so clients can't tell from the link root whether a link points to a file or a folder.

Web needs that to hide actions that are a dead end on single-file links, e.g. "Insert image from cloud" in the text editor: the file picker can only show the shared file itself there (opencloud-eu/web#3631, opencloud-eu/web#3632). For now, web hides the action on all public links, also on folder links where picking an image from the shared folder would be useful.

Steps to reproduce

  1. Create a public link for a single file, e.g. form.pdf (here with a password).
  2. Request the link root:
    curl -u "public:<password>" -X PROPFIND -H "Depth: 1" \
      --data '<?xml version="1.0"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:prop><oc:public-link-item-type/><d:resourcetype/></d:prop></d:propfind>' \
      https://<host>/remote.php/dav/public-files/<token>
  3. Compare with a public link to a folder.

Expected behavior

The link root reports the type of the shared item: file for a link to a single file, folder for a link to a folder (the entries inside keep reporting their own type).

Actual behavior

Both report folder for the root:

Link /public-files/<token>/ entries
single file form.pdf folder form.pdf: file
folder with form.pdf, image.png folder form.pdf: file, image.png: file

(For OCM single-file shares, web already handles the root being reported as file, see packages/web-client/src/webdav/listFiles.ts.)

Setup

opencloudeu/opencloud-rolling:daily, product version 8.1.0+fbb0aff1, started with the docker compose setup of the web repository (docker-compose.yml).

Additional context

If reporting file for the root isn't desired, another property of the link root that tells the shared item's type would work for web as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions