Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return privatelink via DAV #29021

Merged
merged 3 commits into from
Sep 18, 2017
Merged

Return privatelink via DAV #29021

merged 3 commits into from
Sep 18, 2017

Conversation

IljaN
Copy link
Contributor

@IljaN IljaN commented Sep 15, 2017

Description

Possibility to retrieve privatelinks via dav, to facilitate better integration with clients

Related Issue

#28984

How Has This Been Tested?

  • Manually (mitmproxy, cadaver)
  • Integration tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@IljaN IljaN self-assigned this Sep 15, 2017
@IljaN
Copy link
Contributor Author

IljaN commented Sep 15, 2017

Example request/response:

Request:
PROPFIND http://localhost:8000/remote.php/dav/files/admin/foo/zubulski.txt

<?xml version='1.0' encoding='utf-8'?>
<propfind xmlns="DAV:">
  <prop>
    <privatelink xmlns="http://owncloud.org/ns"/>
  </prop>
</propfind>

Response:

<?xml version='1.0' encoding='UTF-8'?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"
xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/"
xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/remote.php/dav/files/admin/foo/zubulski.txt</d:href>
    <d:propstat>
      <d:prop>
        <oc:privatelink>http://localhost:9090/index.php/f/22</oc:privatelink>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

Capabilities

{
   "ocs":{
      "meta":{
         "status":"ok",
         "statuscode":100,
         "message":"OK",
         "totalitems":"",
         "itemsperpage":""
      },
      "data":{
         "version":{
            "major":10,
            "minor":0,
            "micro":3,
            "string":"10.0.3 beta",
            "edition":"Community"
         },
         "capabilities":{
            "core":{
               "pollinterval":60,
               "webdav-root":"remote.php/webdav",
               "status":{
                  "installed":"true",
                  "maintenance":"false",
                  "needsDbUpgrade":"false",
                  "version":"10.0.3.0",
                  "versionstring":"10.0.3 beta",
                  "edition":"Community",
                  "productname":"ownCloud"
               }
            },
            "dav":{
               "chunking":"1.0"
            },
            "files_sharing":{
               "api_enabled":true,
               "public":{
                  "enabled":true,
                  "password":{
                     "enforced":false
                  },
                  "expire_date":{
                     "enabled":false
                  },
                  "send_mail":false,
                  "upload":true,
                  "multiple":true,
                  "supports_upload_only":true
               },
               "user":{
                  "send_mail":false
               },
               "resharing":true,
               "group_sharing":true,
               "default_permissions":31,
               "federation":{
                  "outgoing":true,
                  "incoming":true
               }
            },
            "checksums":{
               "supportedTypes":[
                  "SHA1"
               ],
               "preferredUploadType":"SHA1"
            },
            "files":{
               "privateLinks":true, // <----- New capability
               "bigfilechunking":true,
               "blacklisted_files":[
                  ".htaccess"
               ],
               "undelete":true,
               "versioning":true
            }
         }
      }
   }
}

@IljaN IljaN changed the title Dav return privatelink Return privatelink via dav Sep 15, 2017
@IljaN IljaN changed the title Return privatelink via dav Return privatelink via DAV Sep 15, 2017
@IljaN IljaN requested review from PVince81, SamuAlfageme, ckamm and guruz and removed request for guruz September 15, 2017 12:17
@ckamm
Copy link

ckamm commented Sep 18, 2017

Looks good from a client point of view. The private link returned by the new DAV property works and respects overwritehost. I've implemented and tested the client side handling in owncloud/client#6037

However, the private link displayed in the file browser web ui did not respect overwritehost in my tests! (seems orthogonal to this PR)

ckamm added a commit to owncloud/client that referenced this pull request Sep 18, 2017
* The sharing ui does a propfind anyway: use that to query the new
property as well!
* For the socket api, asynchronously query the server for the right url
when an action that needs it is triggered.

The old, manually generated URL will be used as fallback in case the
server doesn't support the new property or the property can't be
retrieved for some reason.

Depends on owncloud/core#29021
@PVince81
Copy link
Contributor

However, the private link displayed in the file browser web ui did not respect overwritehost in my tests! (seems orthogonal to this PR)

I think the one from the web UI is based on whatever URL is displayed in the web browser / UI, so if that domain does not match overwritehost, then it would not match. In a normal setup I'd expect both to be the same.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍

@PVince81 PVince81 added this to the development milestone Sep 18, 2017
@PVince81 PVince81 merged commit 419cdae into master Sep 18, 2017
@PVince81 PVince81 deleted the dav_return_privatelink branch September 18, 2017 08:26
@PVince81
Copy link
Contributor

@IljaN please backport to stable10

ckamm added a commit to owncloud/client that referenced this pull request Sep 19, 2017
* The sharing ui does a propfind anyway: use that to query the new
property as well!
* For the socket api, asynchronously query the server for the right url
when an action that needs it is triggered.

The old, manually generated URL will be used as fallback in case the
server doesn't support the new property or the property can't be
retrieved for some reason.

Depends on owncloud/core#29021
ckamm added a commit to owncloud/client that referenced this pull request Sep 19, 2017
* The sharing ui does a propfind anyway: use that to query the new
property as well!
* For the socket api, asynchronously query the server for the right url
when an action that needs it is triggered.

The old, manually generated URL will be used as fallback in case the
server doesn't support the new property or the property can't be
retrieved for some reason.

Depends on owncloud/core#29021
rullzer pushed a commit to nextcloud/desktop that referenced this pull request Oct 5, 2017
* The sharing ui does a propfind anyway: use that to query the new
property as well!
* For the socket api, asynchronously query the server for the right url
when an action that needs it is triggered.

The old, manually generated URL will be used as fallback in case the
server doesn't support the new property or the property can't be
retrieved for some reason.

Depends on owncloud/core#29021
@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants