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

Sharees list with user.search_min_length set to 0 returns users in incorrect format #38501

Closed
dpakach opened this issue Mar 12, 2021 · 3 comments · Fixed by #39186
Closed

Sharees list with user.search_min_length set to 0 returns users in incorrect format #38501

dpakach opened this issue Mar 12, 2021 · 3 comments · Fixed by #39186
Labels

Comments

@dpakach
Copy link
Contributor

dpakach commented Mar 12, 2021

Steps to reproduce

  1. set system config user.search_min_length to 0
  2. Get the list of sharees with empty search or without search
curl http://localhost/ocs/v1.php/apps/files_sharing/api/v1/sharees\?itemType\=file -u admin:admin

Expected behaviour

The response should return with empty exact searches and all users in the users section

Actual behaviour

Some users are returned in the exact section

curl http://localhost/ocs/v1.php/apps/files_sharing/api/v1/sharees\?itemType\=file\&format\=json -u admin:admin | jq 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   552  100   552    0     0   2453      0 --:--:-- --:--:-- --:--:--  2442
{
  "ocs": {
    "meta": {
      "status": "ok",
      "statuscode": 100,
      "message": "OK",
      "totalitems": "",
      "itemsperpage": ""
    },
    "data": {
      "exact": {
        "users": [
          {
            "label": "test123",
            "value": {
              "shareType": 0,
              "shareWith": "test123",
              "userType": 0
            }
          },
          {
            "label": "testABC",
            "value": {
              "shareType": 0,
              "shareWith": "testABC",
              "userType": 0
            }
          }
        ],
        "groups": [],
        "remotes": []
      },
      "users": [
        {
          "label": "admin",
          "value": {
            "shareType": 0,
            "shareWith": "admin",
            "userType": 0
          }
        },
        {
          "label": "tu1",
          "value": {
            "shareType": 0,
            "shareWith": "tu1",
            "userType": 0
          }
        }
      ],
      "groups": [
        {
          "label": "admin",
          "value": {
            "shareType": 1,
            "shareWith": "admin"
          }
        }
      ],
      "remotes": []
    }
  }
}

Server configuration

Operating system: ubuntu 20.04

Web server: apache

Database: mysql

PHP version: 7.4

ownCloud version: (see ownCloud admin page) latest git

Updated from an older ownCloud or fresh install: fresh

Where did you install ownCloud from: git

@dpakach
Copy link
Contributor Author

dpakach commented Mar 12, 2021

Looks like only the users which dont have email set are returned in the exact section.
If the email field is empty they are returned under regular users
In the above example admin and tu have email set while test123 and testABC dont have email set.

@IljaN
Copy link
Member

IljaN commented Mar 12, 2021

Could be related to #38489 But probability is low as our code "only" adds an empty return.

if (\strlen(\trim($search)) === 0 && $this->userSearch->getSearchMinLength() > 0) {
$this->result['users'] = [];
return;
}

We should test tough to be 100% sure.

@IljaN
Copy link
Member

IljaN commented Mar 12, 2021

Tested it have the same behaviour before #38489

AlexAndBear pushed a commit that referenced this issue Sep 9, 2021
Don't show exact search results with empty sharee search query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants