Skip to content

Adapt private link generation to core#28984 #6020

Closed

Description

@michaelstingl

After owncloud/core#28984 has been implemented on the server side, the private link generation in desktop client needs a small rework, so parameters in config.php like overwritehost are applied to the link…


config/config.php

  'trusted_domains' => 
  array (
    0 => 'mycloud.example.com',
    1 => '10.135.63.184',
    2 => 'overwritecloud.example.com',
  ),
  'datadirectory' => '/var/www/owncloud/data',
  'overwrite.cli.url' => 'https://overwritecloud.example.com',
  'overwritehost' => 'overwritecloud.example.com',

Expected behaviour

Client should respect overwritehost parameter from config.php for private link generation, same as for public link generation. (Step 5.)

Actual behaviour

Client ignores overwritehost parameter from config.php for private link generation (Step 4.)

Steps to reproduce

  1. Install 2.4.0.*-nightly
  2. Restart explorer.exe
  3. Right-click folder > ownCloud > Copy private link to clipboard
    ==> https://mycloud.example.com/index.php/f/00000171
  4. Right-click folder > ownCloud > Share…
  5. Public Links > Create new > Copy link to clipboard
    ==> https://overwritecloud.example.com/index.php/s/8fJt9YgSZBOmY0o

Server configuration

Operating system:
Ubuntu 16.04.3 LTS

Web server:
Apache/2.4.18 (Ubuntu)

Database:
10.0.31-MariaDB-0ubuntu0.16.04.

PHP version:
PHP 7.0.22-0ubuntu0.16.04.1

ownCloud version:
{"installed":"true","maintenance":"false","needsDbUpgrade":"false","version":"10.0.3.2","versionstring":"10.0.3 RC1","edition":"Enterprise","productname":"ownCloud"}

Storage backend (external storage):
no

Client configuration

Client version:
ownCloud-2.4.0.8310-nightly20170911-setup.exe

Operating system:
Win 8.1, 32-bit

OS language:
EN

Qt version used by client package (Linux only, see also Settings dialog):
5.6.2

Client package (From ownCloud or distro) (Linux only):

Installation path of client:
default

@SamuAlfageme How does the API work? Is this a client or server issue?

Activity

  1. michaelstingl commented on Sep 12, 2017

    @michaelstingl
    ContributorAuthor

    A user reported, private links in the mobile Apps ignore overwritehost parameter too, while public link generation works correct. Perhaps it's a server issue…

  2. SamuAlfageme commented on Sep 12, 2017

    @SamuAlfageme
    Contributor

    @michaelstingl I don't think this core feature ever really reached any of ownCloud's native clients. (It's the first time I'm hearing about it).

    • We currently (since there's no core API for this) rely on the base URL of the server to construct private links by using the internal file id. So 100% for sure this is not used and the client applies the base URL that was set on the wizard.
    • Public links, on the other hand, contain an "url" field in the ocs-reply, if the server sets this one correctly, it'll be the one used:
    {
        "ocs": {
            "meta": {
                "status": "ok",
                "statuscode": 100,
                "message": null
            },
            "data": {
                "id": "1",
                "share_type": 3,
                [...]
                "name": "New public link",
                "url": "https://demo.owncloud.com/s/w0cq5k3tXeiEXmj",
                "mail_send": 0
            }
        }
    }
    

    So yeah, It's a direct consequence of not having a "private link generation endpoint" but rather a spec of how those should be without taking into account the overwritehost (IMO that should be transparent to the client)

  3. michaelstingl commented on Sep 12, 2017

    @michaelstingl
    ContributorAuthor

    If there is no proper API for private link generation yet, I'd vote to remove the feature from the clients for now.

    There is also only an experimental PR to resolve private links where @PVince81 isn't sure if the technical approach is acceptable:
    owncloud/core#28947

    /cc @pmaier1

  4. PVince81 commented on Sep 12, 2017

    @PVince81

    Do you need an API for generating private links ? If needed we could add an additional PROPFIND attribute "oc:privatelink" containing the relative or absolute URL that can be reused as is.

    Advantage: the server controls the format of the link, no client is required to implement an algorithm to compute said links.
    Disadvantage: more data is transferred as every entry in the PROPFIND result would have such link (if the attribute was requested)

  5. SamuAlfageme commented on Sep 12, 2017

    @SamuAlfageme
    Contributor

    @PVince81 endpoint would be quite handy for it considering this issue, yup (see complexity and discussion on #5763)

    I think we don't need to transmit all the file private links on PROPFIND basis (since all of those would belong to the same "domain") but on demand, reducing the overhead and relying on the server reply on runtime rather than storing those in a DB.

    Perhaps we could add a 5th ("private") shareType to ocs endpoint https://doc.owncloud.org/server/10.0/developer_manual/core/ocs-share-api.html#create-a-new-share ?

  6. michaelstingl commented on Sep 12, 2017

    @michaelstingl
    ContributorAuthor

    Sure, I prefer proper generation on the server side, instead of implementing it based on assumptions 3x on all client platforms.

  7. PVince81 commented on Sep 12, 2017

    @PVince81

    On-demand would mean that the client needs to do an extra PROPFIND on the file's endpoint and only query the "oc:privatelink" property.

    Adding this property on the server is trivial. Raised here as junior job: owncloud/core#28984

  8. changed the title [-][2.4.0] Client ignores overwritehost parameter from config.php for private link generation[/-] [+]Adapt private link generation to core#28984[/+] on Sep 12, 2017
  9. ckamm commented on Sep 12, 2017

    @ckamm
    Contributor

    Adding a property to discover a file's private link that's accessible via PROPFIND sounds good to me!

  10. ckamm commented on Sep 15, 2017

    @ckamm
    Contributor

    The new property is called privatelink and there's a new files/privateLinks capability.

  11. assigned and unassigned on Sep 15, 2017
  12. added this to the 2.4.0 milestone on Sep 15, 2017
  13. added
    ReadyToTest
    on Sep 22, 2017
  14. SamuAlfageme commented on Oct 17, 2017

    @SamuAlfageme
    Contributor

    Neat! 👍

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

Metadata

Metadata

Assignees

Labels

EnhancementReadyToTestServer Involved

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions