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

search using current folder option shows the file/folders outside the folder if search keyword is same as current folder #6935

Closed
KarunAtreya opened this issue Aug 2, 2023 · 1 comment · Fixed by #6947
Assignees
Labels

Comments

@KarunAtreya
Copy link
Contributor

KarunAtreya commented Aug 2, 2023

Describe the bug

While searching using current folder feature, it is supposed to search for files and folders inside the current folder. This works fine if the search keyword is not same as the current folder but if the search keyword is same as the current folder, the search result also shows files and folders outside the current folder.

Steps to reproduce

Steps to reproduce the behavior:

  1. admin creates a folder named abc on personal space
  2. admin creates two files named abc.txt and bcd.txt on personal space
  3. admin creates abc.txt and bcd.txt in abc folder
  4. admin navigates to abc folder
  5. admin selects current folder option on search
  6. admin searches for "bcd" and the search result is abc/bcd.txt which is as expected
  7. BUT when admin searches for "abc" the search result are abc, abc.txt, abc/abc.txt

Expected behavior

The search result should only show the results from inside the abc folder.
when admin searches for "abc" the search result should be abc/abc.txt only

Actual behavior

using curl command:


curl -k -XREPORT "https://localhost:9200/remote.php/dav/files/admin/" -u admin:admin -H "Content-Type: application/xml" \
 -d '<?xml version="1.0"?>
<oc:search-files  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
  <d:prop>
    <oc:permissions />
    <oc:favorite />
    <oc:fileid />
    <oc:file-parent />
    <oc:name />
    <oc:owner-id />
    <oc:owner-display-name />
    <oc:shareid />
    <oc:shareroot />
    <oc:share-types />
    <oc:privatelink />
    <d:getcontentlength />
    <oc:size />
    <d:getlastmodified />
    <d:getetag />
    <d:getcontenttype />
    <d:resourcetype />
    <oc:downloadURL />
    <oc:tags />
  </d:prop>
  <oc:search>
    <oc:pattern>+Name:*abc* scope:8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e/abc</oc:pattern>
    <oc:limit>200</oc:limit>
  </oc:search>
</oc:search-files>'\
| xmllint --format -

Response here
<?xml version="1.0"?>
<d:multistatus xmlns:s="http://sabredav.org/ns" xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/remote.php/dav/spaces/8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e/abc</d:href>
    <d:propstat>
      <d:prop>
        <oc:fileid>8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e!eac91939-df49-4fc7-b574-5dc5c372ba6a</oc:fileid>
        <oc:file-parent>8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e!1a022359-447f-4980-8201-c81b51ad9b3e</oc:file-parent>
        <oc:name>abc</oc:name>
        <d:getlastmodified>2023-08-02T04:24:57Z</d:getlastmodified>
        <d:getcontenttype>httpd/unix-directory</d:getcontenttype>
        <oc:permissions>RDNVCK</oc:permissions>
        <oc:highlights/>
        <oc:tags/>
        <d:getetag/>
        <d:resourcetype>
          <d:collection/>
        </d:resourcetype>
        <oc:size>10</oc:size>
        <oc:score>2.035374402999878</oc:score>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/dav/spaces/8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e/abc.txt</d:href>
    <d:propstat>
      <d:prop>
        <oc:fileid>8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e!17e1e4cf-fb3f-470f-a00d-681297ce86e6</oc:fileid>
        <oc:file-parent>8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e!1a022359-447f-4980-8201-c81b51ad9b3e</oc:file-parent>
        <oc:name>abc.txt</oc:name>
        <d:getlastmodified>2023-08-02T04:24:12Z</d:getlastmodified>
        <d:getcontenttype>text/plain</d:getcontenttype>
        <oc:permissions>RDNVW</oc:permissions>
        <oc:highlights/>
        <oc:tags/>
        <d:getetag/>
        <d:resourcetype/>
        <d:getcontentlength>4</d:getcontentlength>
        <oc:score>1.7110203504562378</oc:score>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/dav/spaces/8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e/abc/abc.txt</d:href>
    <d:propstat>
      <d:prop>
        <oc:fileid>8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e!e9afa5cb-25de-4061-bbf8-c3d03b13f5b1</oc:fileid>
        <oc:file-parent>8cd12259-5fdd-45e8-8d84-ac60987b6021$1a022359-447f-4980-8201-c81b51ad9b3e!eac91939-df49-4fc7-b574-5dc5c372ba6a</oc:file-parent>
        <oc:name>abc.txt</oc:name>
        <d:getlastmodified>2023-08-02T04:24:26Z</d:getlastmodified>
        <d:getcontenttype>text/plain</d:getcontenttype>
        <oc:permissions>RDNVW</oc:permissions>
        <oc:highlights/>
        <oc:tags/>
        <d:getetag/>
        <d:resourcetype/>
        <d:getcontentlength>5</d:getcontentlength>
        <oc:score>1.7110203504562378</oc:score>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

Setup

local

@phil-davis
Copy link
Contributor

@KarunAtreya step 2 says:
"admin creates two folders named abc.txt and bcd.txt on personal space"
should that say "admin creates two files named abc.txt and bcd.txt on personal space"?

@2403905 2403905 self-assigned this Aug 2, 2023
@2403905 2403905 mentioned this issue Aug 2, 2023
9 tasks
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.

3 participants