Skip to content

userid not set, request URL wrong, sample-client does not work #994

@bglass

Description

@bglass

Hi there, I am only starting to use this library, so forgive me if I am using it wrong. Nevertheless, the documentation is very brief, new library users depend on understanding the sample client.

At this moment the sample client does not work as provided. For instance, startRefresh() is sending a request to the NextCloud server with URL "/remote.php/dav/files/null//". User "null" is wrong, and the double '/' at the end is wrong. The server rejects this URL.

Work around: I inserted setUserId() after setCredential() to get the proper user name in the URL ("/remote.php/dav/files/username//"):

mClient.setCredentials(
    			OwnCloudCredentialsFactory.newBasicCredentials(
    					getString(R.string.username), 
    					getString(R.string.password)
				)
		);
mClient.setUserId("username");

What concerns the trailing "//", I had to change the root folder string in startRefresh():

        ReadFolderRemoteOperation refreshOperation = new ReadFolderRemoteOperation(""); 

instead of

        ReadFolderRemoteOperation refreshOperation = new ReadFolderRemoteOperation(FileUtils.PATH_SEPARATOR); 

It appears that the library does not expect the leading slash in any path.

After these two workarounds, the sample client is working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions