Skip to content

Files FSNode user is not correctly scraped if Nextcloud is hosted in a sub-path #296

Closed
@vwbusguy

Description

@vwbusguy

Describe the bug

The user attribute of the FSNode objects returned from files.listdir is not correct if the Nextcloud instance is hosted in a sub-path. It currently evaluates this based on a assumption that the nextcloud instance is hosted on / and doesn't accommodate for an extra / if hosted in a subpath.

For example, for a Nextcloud instance hosted under /nextcloud, the user of the file will be "files".

FYI - I'm here at the Nextcloud Contributors conference this week and would be happy to connect and submit a PR to fix this while I'm here.

Steps/Code to Reproduce

Assuming nextcloud is installed at /nextcloud.

print("\n".join([f"User: {f.user} Path: {f.full_path} - Size: {f.info.size}" for f in sorted(nc.files.listdir(depth=-1), key = lambda x: x.info.size,reverse = True) if not f.is_dir]))

Expected Results

The .user is the actual user.

Actual Results

The .user attribute is "files".

image

Setup configuration

Nextcloud 30
nc-py-api==0.17.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions