Skip to content

Username with whitespace - #99

Merged
tobiasKaminsky merged 1 commit into
masterfrom
usernameWithWhitespace
Jan 8, 2018
Merged

tobiasKaminsky merged 1 commit into
masterfrom
usernameWithWhitespace

Conversation

@tobiasKaminsky

@tobiasKaminsky tobiasKaminsky commented Nov 22, 2017 •

Copy link
Copy Markdown
Member

As pointed out by @jensd0e, nextcloud can correctly handle usernames with whitespaces in it.
But toggling favorite is not working as the whitespace has to be replaced with %20 as this results in a webdav url.

@tobiasKaminsky tobiasKaminsky changed the title Username with wEscape whitespace Username with whitespace Nov 22, 2017
@AndyScherzinger

AndyScherzinger commented Nov 23, 2017 •

Copy link
Copy Markdown
Member

👍 looks good!

Approved with PullApprove

@mario

mario commented Nov 25, 2017

Copy link
Copy Markdown
Contributor

Maybe do a full url encoding instead of the userId?

@tobiasKaminsky

Copy link
Copy Markdown
Member Author

Maybe do a full url encoding instead of the userId?

There is a more complex logic currently written by you, which only encodes the file name, but not the folders.
Is there a special reason you did it this way? I am unsure if folders with whitespaces are working currently?

String webDavUrl = client.getNewWebdavUri(false).toString();
int pos = filePath.lastIndexOf('/') + 1;
filePath = filePath.substring(0, pos) + Uri.encode(filePath.substring(pos));

Encoding the full path seems to be the correct solution for me?

@mario

mario commented Jan 7, 2018

Copy link
Copy Markdown
Contributor

I was referring to doing URL encoding of the user id, so please do that instead of a simple replace.

But you are right, we should encode the full URL too - please do it, and feel free to do it in this PR.

@tobiasKaminsky

Copy link
Copy Markdown
Member Author

Uri.encode would replace "/" by "%2F" and then the server endpoint does not understand the request.
e.g: user "admin", path "/delete/" --> /nc/remote.php/dav/files/admin%2Fdelete%2F

what we can do is to replace "%2F" with "/" after encoding...

@mario

mario commented Jan 8, 2018 via email

Copy link
Copy Markdown
Contributor

@tobiasKaminsky
tobiasKaminsky force-pushed the usernameWithWhitespace branch 3 times, most recently from 05b5e8c to b7e7330 Compare January 8, 2018 09:40
@tobiasKaminsky
tobiasKaminsky force-pushed the usernameWithWhitespace branch from b7e7330 to 93c8bab Compare January 8, 2018 09:41
@tobiasKaminsky

Copy link
Copy Markdown
Member Author

@mario done and tested 👍

@mario

mario commented Jan 8, 2018 via email

Copy link
Copy Markdown
Contributor

@tobiasKaminsky
tobiasKaminsky merged commit 6fa5989 into master Jan 8, 2018
@tobiasKaminsky
tobiasKaminsky deleted the usernameWithWhitespace branch January 8, 2018 10:13
@tobiasKaminsky
tobiasKaminsky restored the usernameWithWhitespace branch January 8, 2018 13:41
@tobiasKaminsky tobiasKaminsky added this to the NC lib 1.0.34 milestone Jan 11, 2018
@AndyScherzinger
AndyScherzinger deleted the usernameWithWhitespace branch February 6, 2019 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants