Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Public link single file share #278

Closed
PVince81 opened this issue Jun 17, 2020 · 8 comments
Closed

Public link single file share #278

PVince81 opened this issue Jun 17, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@PVince81
Copy link
Contributor

We have cs3org/reva#822 but it doesn't implement single file

@PVince81 PVince81 added the enhancement New feature or request label Jun 17, 2020
@refs
Copy link
Member

refs commented Jun 18, 2020

handlePropfind handler breakdown:

  • unmarshap propfind from the request body on pf
  • get a client to the gateway
  • create a path based reference
    • and a request with such reference
  • do a stat request on the reference
  • check response status code
  • so the stat request properly resolves the path based reference and gets the right file:
status:<code:CODE_OK trace:"c6ab889a57bfa2c69b0b9449ad87b78d" > info:<type:RESOURCE_TYPE_FILE id:<storage_id:"1284d238-aa92-42ce-bdc4-0b0000009162" opaque_id:"7138f0f9-cce7-4d7a-9480-735922a531ef" > etag:"\"98e60dd6abcb8acd60f5d84dd833f841\"" mime_type:"text/plain; charset=utf-8" mtime:<seconds:1592327644 > path:"/ItYJjJNdiuEn" permission_set:<create_container:true list_container:true > owner:<opaque_id:"einstein" > arbitrary_metadata:<metadata:<key:"http://owncloud.org/ns/favorite" value:"" > > >
  • so, the contents of info / infos are correct, a single file:
info:
type:RESOURCE_TYPE_FILE id:<storage_id:"1284d238-aa92-42ce-bdc4-0b0000009162" opaque_id:"7138f0f9-cce7-4d7a-9480-735922a531ef" > etag:"\"98e60dd6abcb8acd60f5d84dd833f841\"" mime_type:"text/plain; charset=utf-8" mtime:<seconds:1592327644 > path:"/ItYJjJNdiuEn" permission_set:<create_container:true list_container:true > owner:<opaque_id:"einstein" > arbitrary_metadata:<metadata:<key:"http://owncloud.org/ns/favorite" value:"" > >

infos:
[type:RESOURCE_TYPE_FILE id:<storage_id:"1284d238-aa92-42ce-bdc4-0b0000009162" opaque_id:"7138f0f9-cce7-4d7a-9480-735922a531ef" > etag:"\"98e60dd6abcb8acd60f5d84dd833f841\"" mime_type:"text/plain; charset=utf-8" mtime:<seconds:1592327644 > path:"/ItYJjJNdiuEn" permission_set:<create_container:true list_container:true > owner:<opaque_id:"einstein" > arbitrary_metadata:<metadata:<key:"http://owncloud.org/ns/favorite" value:"" > > ]
  • what about the contents of propRes?
<?xml version="1.0" encoding="utf-8"?>
<d:multistatus xmlns:d="DAV:" 
    xmlns:s="http://sabredav.org/ns" 
    xmlns:oc="http://owncloud.org/ns">
    <d:response>
        <d:href>/remote.php/dav/public-files/ItYJjJNdiuEn</d:href>
        <d:propstat>
            <d:prop>
                <oc:permissions>WCKDNVR</oc:permissions>
                <oc:favorite>0</oc:favorite>
                <oc:fileid>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTYyOjcxMzhmMGY5LWNjZTctNGQ3YS05NDgwLTczNTkyMmE1MzFlZg==</oc:fileid>
                <oc:owner-id>einstein</oc:owner-id>
                <d:getcontentlength>0</d:getcontentlength>
                <oc:size>0</oc:size>
                <d:getlastmodified>Tue, 16 Jun 2020 17:14:04 +0000</d:getlastmodified>
                <d:getetag>"98e60dd6abcb8acd60f5d84dd833f841"</d:getetag>
                <d:resourcetype></d:resourcetype>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <oc:owner-display-name></oc:owner-display-name>
                <oc:share-types></oc:share-types>
                <oc:privatelink></oc:privatelink>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
</d:multistatus>

Could the culprit be that handlePropfind does not know how to resolve the public share? This translates in: get the path from the

The propfind request looks like:

<?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:resourcetype />
  </d:prop>
</d:propfind>

@refs
Copy link
Member

refs commented Jun 18, 2020

The culprit looks like:

  • do PROPFIND on a public share: i.e: https://localhost:9200/#/files/public-files/ItYJjJNdiuEn
  • there is only one response, containing no file.
  • we need to treat the public link as a "container" with a file on it, the shared file.

@refs
Copy link
Member

refs commented Jun 18, 2020

for comparison, an oc10 response looks like:

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" 
    xmlns:s="http://sabredav.org/ns" 
    xmlns:oc="http://owncloud.org/ns">
    <d:response>
        <d:href>/remote.php/dav/public-files/ymdtTSZdX5NU5Vm/</d:href>
        <d:propstat>
            <d:prop>
                <oc:permissions></oc:permissions>
                <d:resourcetype>
                    <d:collection/>
                </d:resourcetype>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <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:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
    <d:response>
        <d:href>/remote.php/dav/public-files/ymdtTSZdX5NU5Vm/WARNER%20BROTHERS%20PRESENTATION.pdf</d:href>
        <d:propstat>
            <d:prop>
                <oc:permissions></oc:permissions>
                <oc:fileid>167</oc:fileid>
                <oc:owner-id>demo</oc:owner-id>
                <oc:owner-display-name>demo</oc:owner-display-name>
                <d:getcontentlength>94021780</d:getcontentlength>
                <oc:size>94021780</oc:size>
                <d:getlastmodified>Thu, 18 Jun 2020 12:20:20 GMT</d:getlastmodified>
                <d:getetag>&quot;a74ff5f5181645052f3cbcd94025151c&quot;</d:getetag>
                <d:resourcetype/>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <oc:favorite/>
                <oc:share-types/>
                <oc:privatelink/>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
</d:multistatus>

@refs
Copy link
Member

refs commented Jun 18, 2020

After a few tweaks, was able to distinguish between files and containers (folders) and add a conditional to add a container to the PROPFIND:

<?xml version="1.0" encoding="utf-8"?>
<d:multistatus xmlns:d="DAV:" 
    xmlns:s="http://sabredav.org/ns" 
    xmlns:oc="http://owncloud.org/ns">
    <d:response>
        <d:href>/remote.php/dav/public-files/</d:href>
        <d:propstat>
            <d:prop>
                <oc:favorite>0</oc:favorite>
                <oc:size>0</oc:size>
                <d:getlastmodified>Tue, 16 Jun 2020 17:14:04 +0000</d:getlastmodified>
                <d:resourcetype>
                    <d:collection/>
                </d:resourcetype>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <oc:permissions></oc:permissions>
                <oc:fileid></oc:fileid>
                <oc:owner-id></oc:owner-id>
                <oc:owner-display-name></oc:owner-display-name>
                <oc:share-types></oc:share-types>
                <oc:privatelink></oc:privatelink>
                <d:getcontentlength></d:getcontentlength>
                <d:getetag></d:getetag>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
    <d:response>
        <d:href>/remote.php/dav/public-files/ItYJjJNdiuEn</d:href>
        <d:propstat>
            <d:prop>
                <oc:permissions>WCKDNVR</oc:permissions>
                <oc:favorite>0</oc:favorite>
                <oc:fileid>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTYyOjcxMzhmMGY5LWNjZTctNGQ3YS05NDgwLTczNTkyMmE1MzFlZg==</oc:fileid>
                <oc:owner-id>einstein</oc:owner-id>
                <d:getcontentlength>0</d:getcontentlength>
                <oc:size>0</oc:size>
                <d:getlastmodified>Tue, 16 Jun 2020 17:14:04 +0000</d:getlastmodified>
                <d:getetag>"98e60dd6abcb8acd60f5d84dd833f841"</d:getetag>
                <d:resourcetype></d:resourcetype>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <oc:owner-display-name></oc:owner-display-name>
                <oc:share-types></oc:share-types>
                <oc:privatelink></oc:privatelink>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
</d:multistatus>

@refs
Copy link
Member

refs commented Jun 18, 2020

this has been implemented on cs3org/reva#822, see: cs3org/reva@575b62b

@PVince81
Copy link
Contributor Author

new PR here cs3org/reva#895 with a cleaner approach

@PVince81 PVince81 self-assigned this Jun 29, 2020
@PVince81
Copy link
Contributor Author

PVince81 commented Jun 29, 2020

@PVince81
Copy link
Contributor Author

released in 1.0.0-beta6

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants