Contacts: "/" in a user group name doesn't work

Created on 4 Oct 2017  路  11Comments  路  Source: nextcloud/contacts

Steps to reproduce

  1. create a user group with a "/" in the name
  2. try to open/list the group

Expected behaviour

Should see the list of users in the group

Actual behaviour

nothing shown

Additional Info

The group name is used in the url and if i click the group the group name is not correct.
I think there is a encoding missing
Example: /test/group/name/

Operating system:
Ubuntu 16.04
Web server:
nginx 1.12.1
Database:
MySQL 10.0.31
PHP version:
7.1.10
Nextcloud version: (see Nextcloud admin page)
12.0.3
Contacts version: (see Nextcloud apps page)
2.0.0

Logs

Browser log

"Error: [ngRoute:norout] Tried updating route when with no current route
http://errors.angularjs.org/1.5.8/ngRoute/norout
minErr/<@https://www.mydomain.com/apps/contacts/js/vendor/angular/angular.js?v=d8c899cfa89b40c78a91a85e930daeb6-0:68:12
updateParams@https://www.mydomain.com/apps/contacts/js/vendor/angular-route/angular-route.js?v=d8c899cfa89b40c78a91a85e930daeb6-0:559:21
@https://www.mydomain.com/apps/contacts/js/public/script.js?v=d8c899cfa89b40c78a91a85e930daeb6-0:916:5
$digest@https://www.mydomain.com/apps/contacts/js/vendor/angular/angular.js?v=d8c899cfa89b40c78a91a85e930daeb6-0:17524:23
$apply@https://www.mydomain.com/apps/contacts/js/vendor/angular/angular.js?v=d8c899cfa89b40c78a91a85e930daeb6-0:17790:13
ngEventHandler/<@https://www.mydomain.com/apps/contacts/js/vendor/angular/angular.js?v=d8c899cfa89b40c78a91a85e930daeb6-0:25890:17
dispatch@https://www.mydomain.com/core/vendor/core.js?v=d8c899cfa89b40c78a91a85e930daeb6-0:3:6414
add/r.handle@https://www.mydomain.com/core/vendor/core.js?v=d8c899cfa89b40c78a91a85e930daeb6-0:3:3224
"
2. developing bug medium

All 11 comments

The same happens with ? and #

I can try to fix this

This happens because we use the group name as part of the url.
It should be urlencoded before this.

@anestv any update on this?

Here's what I tried (but I didn't manage to get it working):

  • used encodeURIComponent at ctrl.setSelected in groupList_controller.js
  • created a filter to pass the name through encodeURIComponent and changed ng-href="#/{{ctrl.group}}" to ng-href="#/{{ctrl.group | groupNameEscape}}"

Since running encodeURIComponent didn't seem to change anything in the link's address, I tried encodeURIComponent(encodeURIComponent()) but it wouldn't work either

Do you have some code you want to share?
Otherwise I would have a go at it.

You can have a look at my fork, https://github.com/anestv/contacts
Of course feel free to have a go at it

this is a really nasty issue...
We aren't the first who stumbled over this: https://github.com/angular/angular.js/issues/10479

There are multiple "solutions":

  • Do some kind of double urlencoding leading to urls like http://localhost:8080/index.php/apps/contacts#/%252Ftest?uid=5e93e859-8570-45ec-9051-3dfebd7d182b. Also this might break other characters like #.
  • Single urlencoding which fixes #, but doesn't help with slashes. We would have to replace slashes with some other character. (which one?)
  • allow multiple slashes inside the gid parameter. A route would then look like this: /:gid*. This conflicts with the other route /:gid*/:uid, so I would propose to change our route scheme to /group/:gid*/contact/:uid.

@nextcloud/contacts your feedback is needed here

Do your best! I have no problem with the route scheme update.

Shouldn't a / encoded to %2F?

Shouldn't a / encoded to %2F?

if it's encoded once this is true. But in this case AngularJS decodes it itself and fails to resolve the route.
%252F is the result when / is encoded twice, which isn't mistakenly decoded by angular.

Is there any temporary workaround? I tried to update the entry in oc_vcategory and cleaned the redis, but the group still shows with a slash and cannot be opened.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

silverhook picture silverhook  路  5Comments

spoorun picture spoorun  路  3Comments

stvogel picture stvogel  路  3Comments

caugner picture caugner  路  3Comments

Peque picture Peque  路  3Comments