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

implement quota fetching #3745

Closed
wants to merge 6 commits into from
Closed

implement quota fetching #3745

wants to merge 6 commits into from

Conversation

butonic
Copy link
Member

@butonic butonic commented May 9, 2022

We implemented fetching the personal space quota on the ocs endpoint. But since quota is unset by default we currently cannot calculate meaningful values for total or relative. The web UI should omit that information instead of trying to eg. divide by 0: owncloud/web#6913

I also tried reporting -3 (unlimited) but that is something the web ui would have to learn as well ...

So for now I think the best way forwrd is to leave out info that is not there and deal with that case properly.

quota setting tracked in #3748

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@update-docs
Copy link

update-docs bot commented May 9, 2022

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@butonic butonic requested review from wkloucek and micbar May 9, 2022 10:51
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@ownclouders
Copy link
Contributor

ownclouders commented May 9, 2022

💥 Acceptance test Core-API-Tests-ocis-storage-8 failed. Further test are cancelled...

@butonic
Copy link
Member Author

butonic commented May 9, 2022

https://drone.owncloud.com/owncloud/ocis/11623/51/10 may need a fix in web, or should we mark this as an expected failure for now? @kulmann this PR currently prevents login ...

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@butonic butonic self-assigned this May 11, 2022
@butonic butonic force-pushed the quota-fetching branch 6 times, most recently from aa7d70e to b986f02 Compare May 11, 2022 20:27
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@sonarcloud
Copy link

sonarcloud bot commented May 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Comment on lines +183 to +185
// TODO support negative values or flags for the quota to carry special meaning: -1 = uncalculated, -2 = unknown, -3 = unlimited
// for now we can only report total and used
Total: int64(total),
Copy link
Member Author

Choose a reason for hiding this comment

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

the oc10 code has this: https://github.com/owncloud/core/blob/817f54f53d64249166feaa0eb9231c50ca1ed7e0/lib/public/Files/FileInfo.php#L44-L58

it is returned for quota-available-bytes in propfind requests:

 $ curl https://demo.owncloud.com/remote.php/webdav/ -udemo:demo -X PROPFIND -d '<?xml version="1.0" ?><d:propfind xmlns:d="DAV:"><d:prop><d:quota-available-bytes/><d:quota-used-bytes/></d:prop></d:propfind>' -v --trace-time | xmllint -format -

...

  <d:response>
    <d:href>/remote.php/webdav/Photos/</d:href>
    <d:propstat>
      <d:prop>
        <d:quota-available-bytes>-3</d:quota-available-bytes>
        <d:quota-used-bytes>1011464</d:quota-used-bytes>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
...

the ocs api only returns quota on the /ocs/v[1|2].php/cloud/users/{username} endpoint:

$ curl https://demo.owncloud.com/ocs/v1.php/cloud/users/demo?format=json -u demo:demo -v | jq

...

      "quota": {
        "free": 27273637888,
        "used": 7716359,
        "total": 27281354247,
        "relative": 0.03,
        "definition": "none"
      },

...

but it always returns the actually available bytes, not -3 ...

@butonic
Copy link
Member Author

butonic commented May 13, 2022

urgh ... so can we please kill all but signing from the ocis ocs implementation and move everything into reva, requiring cs3org/reva#2870?

Or do we remove everything ocs related from reva, make it the cs3 api only repo and move ocs to ocis?

One way to move forward is to leave ocs and ocdav in reva but flesh out libregraph in ocis... the signing key could be replaced with webdav urls in the libregraph api: https://docs.microsoft.com/de-de/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http#request

a GET /me/drive/items/{item-id}/content returns a redirect:

HTTP/1.1 302 Found
Location: https://b0mpua-by3301.files.1drv.com/y23vmagahszhxzlcvhasdhasghasodfi

so we could return a signed url here

@butonic
Copy link
Member Author

butonic commented May 18, 2022

closing in favor of cs3org/reva#2870

@butonic butonic closed this May 18, 2022
@butonic butonic deleted the quota-fetching branch November 7, 2022 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants