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

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

Closed
bglass opened this issue Nov 14, 2022 · 1 comment · Fixed by #996
Closed

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

bglass opened this issue Nov 14, 2022 · 1 comment · Fixed by #996

Comments

@bglass
Copy link

bglass commented Nov 14, 2022

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.

@AlvaroBrey
Copy link
Member

Fix for the double slash is in #996 , although most webservers should ignore double slashes and treat them as a single slash.

cc @tobiasKaminsky for the sample client bug

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

Successfully merging a pull request may close this issue.

2 participants