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

client.getQuota() does not return the correct quota #331

Open
pasenau opened this issue Apr 26, 2022 · 0 comments
Open

client.getQuota() does not return the correct quota #331

pasenau opened this issue Apr 26, 2022 · 0 comments

Comments

@pasenau
Copy link

pasenau commented Apr 26, 2022

Describe the bug
client.getQuota() returns two numbers that are not the real available or used quota of the user. These two numbers are from two separated entries of the PROPFIND command issued inside the getQuota() call.

To Reproduce
Steps to reproduce the behavior:

  1. create a user with a specific quota, an fill in some files and folders
  2. get the quota of that user:
const ncc = require( 'nextcloud-node-client');
const server_data = { basicAuth: { username: auth.username, password: auth.password }, url: server_url, };
const server = new ncc.Server( server_data );
const client = new ncc.Client( server);
const user_quota = await client.getQuota();

Correction
after looking into the code:

  public async getQuota(): Promise<IQuota> {
    log.debug("getQuota");
    const requestInit: RequestInit = {
      method: "PROPFIND",
    };

    const response: Response = await this.getHttpResponse(this.webDAVUrl + "/", requestInit, [207], { description: "Client get quota" });
    ...

In requestInit it seems that headers: new node_fetch_1.Headers({ "Depth": "0" }), is missing.
With

    const requestInit: RequestInit = {
      method: "PROPFIND",
      headers: new node_fetch_1.Headers({ "Depth": "0" }),
    };

it returns the expected result.
client_patch.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant