owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.38k stars 181 forks source link

Downloading the archive of the resource (files | folder) using resource `path` is not possible #4637

Open SagarGi opened 2 years ago

SagarGi commented 2 years ago

Describe the bug

When downloading the archive of resource (files | folders) using the resource path (full path of the resource) , the response status is 404.

Steps to reproduce

Steps to reproduce the behavior:

  1. create user user
  2. create a file file.txt
  3. download the archive of the file file with the command below

Curl Command to download the file.

curl -X GET -vk -u user:123456 https://host.docker.internal:9200/archiver?path=file.txt

Expected behavior

Should be able to download the archive of the text file. (with Response status code 200)

Actual behavior

TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Length: 27
< Content-Type: text/plain; charset=utf-8
< Date: Thu, 22 Sep 2022 10:09:53 GMT
< Vary: Origin
< 
* Connection #0 to host host.docker.internal left intact
error: not found: file.txt%   

Setup

OCIS : latest pulled docker image

NOTE:

If anyone could provided the correct URL to download or get the resource. if its https://host.docker.internal:9200/archiver?path=file.txt like this or https://host.docker.internal:9200/archiver?path=/home/file.txt or other?

individual-it commented 2 years ago

@kobergj I think you have added the related tests to expected to fail file, could you clarify if this actually should work or not

micbar commented 2 years ago

@butonic Does path based archiver requests work at all?

saw-jan commented 1 month ago

looks like both path and id query params are allowed. But providing: ?path=foldername ?path=/foldername returns 404 https://github.com/cs3org/reva/blob/774910f82ee098c8b5ceb3457d1678245d20b137/internal/http/services/archiver/handler.go#L224-L230

        v := r.URL.Query()

        paths, ok := v["path"]
        if !ok {
            paths = []string{}
        }
        ids, ok := v["id"]

https://github.com/cs3org/reva/blob/774910f82ee098c8b5ceb3457d1678245d20b137/internal/http/services/archiver/handler.go#L144-L151

    for _, p := range paths {
        // id is base64 encoded and after decoding has the form <storage_id>:<resource_id>

        resp, err := gatewayClient.Stat(ctx, &provider.StatRequest{
            Ref: &provider.Reference{
                Path: p,
            },
        })