Skip to content

feat: indicate if file has preview - #214

Merged
micbar merged 1 commit into
mainfrom
webdav-preview
Jun 26, 2025
Merged

feat: indicate if file has preview#214
micbar merged 1 commit into
mainfrom
webdav-preview

Conversation

@micbar

@micbar micbar commented May 16, 2025

Copy link
Copy Markdown
Member

Description

Indicate if a resource can render a thumbnail.

Context

We have different implementations of our thumbnail service which include capabilities for different formats.

This flag on the PROPFIND enables clients to see if a preview is available and can be reqested.

openCloud context

We have two thumbnailers:

  1. Based on go only
  2. Based on libvips bindings

The included mimetype list is different in the two build scenarios.

Examples

Request

curl --location --request PROPFIND 'https://cloud.opencloud.test:9200/remote.php/dav/spaces/storage-users-1%24some-admin-user-id-0000-000000000000/' \
--header 'Origin: https://localhost' \
--header 'Access-Control-Request-Method: PROPFIND' \
--header 'Depth: 1' \
--header 'Content-Type: application/xml' \
--header 'Authorization: ••••••' \
--data '<?xml version="1.0"?>
<d:propfind  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
  <d:prop>
    <oc:permissions />
    <oc:favorite />
    <oc:fileid />
    <oc:owner-id />
    <oc:owner-display-name />
    <oc:share-types />
    <oc:privatelink />
    <d:getcontentlength />
    <oc:size />
    <d:getlastmodified />
    <d:getetag />
    <d:getcontenttype />
    <d:resourcetype />
    <oc:downloadURL />
    <oc:has-preview />
  </d:prop>
</d:propfind>'

Response

<d:multistatus xmlns:s="http://sabredav.org/ns" xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
    <d:response>
        <d:href>/remote.php/dav/spaces/storage-users-1$some-admin-user-id-0000-000000000000/</d:href>
        <d:propstat>
            <d:prop>
                <oc:permissions>RDNVCKZP</oc:permissions>
                <oc:favorite>0</oc:favorite>
                <oc:fileid>storage-users-1$some-admin-user-id-0000-000000000000!some-admin-user-id-0000-000000000000</oc:fileid>
                <oc:owner-id>admin</oc:owner-id>
                <oc:owner-display-name>Admin</oc:owner-display-name>
                <oc:privatelink>https://cloud.opencloud.test:9200/f/storage-users-1$some-admin-user-id-0000-000000000000%21some-admin-user-id-0000-000000000000</oc:privatelink>
                <oc:size>669301</oc:size>
                <d:getlastmodified>Fri, 16 May 2025 11:28:59 GMT</d:getlastmodified>
                <d:getetag>"c76ca7c79c3dc4691e8375945af9244e"</d:getetag>
                <d:resourcetype>
                    <d:collection/>
                </d:resourcetype>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <oc:share-types></oc:share-types>
                <d:getcontentlength></d:getcontentlength>
                <d:getcontenttype></d:getcontenttype>
                <oc:downloadURL></oc:downloadURL>
                <oc:has-preview></oc:has-preview>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
    <d:response>
        <d:href>/remote.php/dav/spaces/storage-users-1$some-admin-user-id-0000-000000000000/New%20file.odp</d:href>
        <d:propstat>
            <d:prop>
                <oc:permissions>RDNVWZP</oc:permissions>
                <oc:favorite>0</oc:favorite>
                <oc:fileid>storage-users-1$some-admin-user-id-0000-000000000000!c1122547-f9c8-4c72-9b29-9e221acf0bf0</oc:fileid>
                <oc:owner-id>admin</oc:owner-id>
                <oc:owner-display-name>Admin</oc:owner-display-name>
                <oc:privatelink>https://cloud.opencloud.test:9200/f/storage-users-1$some-admin-user-id-0000-000000000000%21c1122547-f9c8-4c72-9b29-9e221acf0bf0</oc:privatelink>
                <d:getcontentlength>0</d:getcontentlength>
                <oc:size>0</oc:size>
                <d:getlastmodified>Mon, 12 May 2025 16:09:08 GMT</d:getlastmodified>
                <d:getetag>"d433d313b888ff632374156220a708d6"</d:getetag>
                <d:getcontenttype>application/vnd.oasis.opendocument.presentation</d:getcontenttype>
                <d:resourcetype></d:resourcetype>
                <oc:has-preview>0</oc:has-preview>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <oc:share-types></oc:share-types>
                <oc:downloadURL></oc:downloadURL>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
    <d:response>
        <d:href>/remote.php/dav/spaces/storage-users-1$some-admin-user-id-0000-000000000000/sample1.webp</d:href>
        <d:propstat>
            <d:prop>
                <oc:permissions>RDNVWZP</oc:permissions>
                <oc:favorite>0</oc:favorite>
                <oc:fileid>storage-users-1$some-admin-user-id-0000-000000000000!9c5bb639-1289-444f-89fa-cc7655e31591</oc:fileid>
                <oc:owner-id>admin</oc:owner-id>
                <oc:owner-display-name>Admin</oc:owner-display-name>
                <oc:privatelink>https://cloud.opencloud.test:9200/f/storage-users-1$some-admin-user-id-0000-000000000000%219c5bb639-1289-444f-89fa-cc7655e31591</oc:privatelink>
                <d:getcontentlength>658538</d:getcontentlength>
                <oc:size>658538</oc:size>
                <d:getlastmodified>Mon, 12 May 2025 14:32:25 GMT</d:getlastmodified>
                <d:getetag>"768c1e2e621de08c815644f45029171c"</d:getetag>
                <d:getcontenttype>image/webp</d:getcontenttype>
                <d:resourcetype></d:resourcetype>
                <oc:has-preview>1</oc:has-preview>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <oc:share-types></oc:share-types>
                <oc:downloadURL></oc:downloadURL>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
    <d:response>
        <d:href>/remote.php/dav/spaces/storage-users-1$some-admin-user-id-0000-000000000000/400px-Docker-compose-logo.jpg</d:href>
        <d:propstat>
            <d:prop>
                <oc:permissions>RDNVWZP</oc:permissions>
                <oc:favorite>0</oc:favorite>
                <oc:fileid>storage-users-1$some-admin-user-id-0000-000000000000!9a4cba30-9062-4705-a88b-a33916930fc6</oc:fileid>
                <oc:owner-id>admin</oc:owner-id>
                <oc:owner-display-name>Admin</oc:owner-display-name>
                <oc:privatelink>https://cloud.opencloud.test:9200/f/storage-users-1$some-admin-user-id-0000-000000000000%219a4cba30-9062-4705-a88b-a33916930fc6</oc:privatelink>
                <d:getcontentlength>10763</d:getcontentlength>
                <oc:size>10763</oc:size>
                <d:getlastmodified>Mon, 05 May 2025 15:47:09 GMT</d:getlastmodified>
                <d:getetag>"694a946694796435f72fbd8c7240ea13"</d:getetag>
                <d:getcontenttype>image/jpeg</d:getcontenttype>
                <d:resourcetype></d:resourcetype>
                <oc:has-preview>1</oc:has-preview>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <oc:share-types></oc:share-types>
                <oc:downloadURL></oc:downloadURL>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
</d:multistatus>

@micbar
micbar requested review from aduffeck, butonic, kulmann and rhafer May 16, 2025 11:23
@micbar
micbar force-pushed the webdav-preview branch 3 times, most recently from c83d771 to ef83818 Compare May 16, 2025 11:54
@micbar
micbar requested a review from AlexAndBear May 16, 2025 12:07

@rhafer rhafer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not really happy that we add yet another reva -> opencloud depency here, but I am also lacking some better idea currently.

Comment thread internal/http/services/owncloud/ocdav/propfind/propfind.go
@micbar
micbar force-pushed the webdav-preview branch 3 times, most recently from 170145d to a33e570 Compare June 20, 2025 13:14
@micbar

micbar commented Jun 23, 2025

Copy link
Copy Markdown
Member Author

I am not really happy that we add yet another reva -> opencloud depency here, but I am also lacking some better idea currently.

I spoke with @aduffeck We can shift the mimetypes map to reva.

@rhafer

rhafer commented Jun 23, 2025

Copy link
Copy Markdown
Member

I spoke with @aduffeck We can shift the mimetypes map to reva.

Can we? The defaults for SupportedMimeTypes depend on the selected thumbnailing backend (vips vs. native go) in the thumbnails service. Moving that to reva would mean that we need some kind of manual configuration without good default. I might be misunderstanding the proposal.

@db-ot

db-ot commented Jun 26, 2025

Copy link
Copy Markdown

related WEB-UI TIcket opencloud-eu/web#864

@micbar
micbar force-pushed the webdav-preview branch 2 times, most recently from d802488 to dde4262 Compare June 26, 2025 09:01
@micbar

micbar commented Jun 26, 2025

Copy link
Copy Markdown
Member Author

@rhafer Rebased and cleaned up the go deps.

@micbar
micbar merged commit 2223230 into main Jun 26, 2025
@micbar
micbar deleted the webdav-preview branch June 26, 2025 14:27
@github-project-automation github-project-automation Bot moved this to Qualification in OpenCloud Team Board Jun 27, 2025
@guruz

guruz commented Aug 20, 2026

Copy link
Copy Markdown

Please also create mobile client follow-up issues when you create a new feature in server, not only web UI :)

Android here: opencloud-eu/android#217
iOS will follow.

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

Projects

Status: Needs Tests

Development

Successfully merging this pull request may close these issues.

5 participants