Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit f279e98

Browse files
committed
eosbinary: change name parameter and sandbox project
1 parent 799351d commit f279e98

File tree

3 files changed

+49
-46
lines changed

3 files changed

+49
-46
lines changed

internal/http/services/owncloud/ocdav/report.go

+42-42
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (s *svc) doSearchFiles(w http.ResponseWriter, r *http.Request, sf *reportSe
8989
}
9090

9191
// TODO(salfagem): hardcoded path for the time being:
92-
ref := &provider.Reference{Path: "/eos/project/c/cernbox"}
92+
ref := &provider.Reference{Path: "/eos/project/t/test"}
9393

9494
req := &provider.ListContainerRequest{Opaque: &typespb.Opaque{
9595
Map: opaqueMap,
@@ -103,52 +103,52 @@ func (s *svc) doSearchFiles(w http.ResponseWriter, r *http.Request, sf *reportSe
103103
return
104104
}
105105

106+
log.Debug().Msgf("search: found %d matches", len(res.Infos))
107+
106108
for _, v := range res.Infos {
107109
log.Debug().Msg(v.Path)
108110
}
109111

110112
data := `
111-
<?xml version="1.0" encoding="UTF-8"?>
112-
<d:multistatus xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:s="http://sabredav.org/ns">
113-
<d:response>
114-
<d:href>/remote.php/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157$4c510ada-c86b-4815-8820-42cdf82c3d51/asd.txt</d:href>
115-
<d:propstat>
116-
<d:prop>
117-
<oc:fileid>1284d238-aa92-42ce-bdc4-0b0000009157$4c510ada-c86b-4815-8820-42cdf82c3d51!d5613880-307c-4e3e-b56d-97839fcf6d03</oc:fileid>
118-
<oc:file-parent>1284d238-aa92-42ce-bdc4-0b0000009157$4c510ada-c86b-4815-8820-42cdf82c3d51!4c510ada-c86b-4815-8820-42cdf82c3d51</oc:file-parent>
119-
<oc:name>asd.txt</oc:name>
120-
<d:getlastmodified>2022-11-08T10:45:16Z</d:getlastmodified>
121-
<d:getcontenttype>text/plain</d:getcontenttype>
122-
<oc:permissions>RDNVW</oc:permissions>
123-
<d:getetag />
124-
<d:resourcetype />
125-
<d:getcontentlength>0</d:getcontentlength>
126-
<oc:score>0.4809828996658325</oc:score>
127-
</d:prop>
128-
<d:status>HTTP/1.1 200 OK</d:status>
129-
</d:propstat>
130-
</d:response>
131-
<d:response>
132-
<d:href>/remote.php/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157$4c510ada-c86b-4815-8820-42cdf82c3d51/asdddddd</d:href>
133-
<d:propstat>
134-
<d:prop>
135-
<oc:fileid>1284d238-aa92-42ce-bdc4-0b0000009157$4c510ada-c86b-4815-8820-42cdf82c3d51!fa3c7a85-5fc4-46d3-a0b1-293a282da1b7</oc:fileid>
136-
<oc:file-parent>1284d238-aa92-42ce-bdc4-0b0000009157$4c510ada-c86b-4815-8820-42cdf82c3d51!4c510ada-c86b-4815-8820-42cdf82c3d51</oc:file-parent>
137-
<oc:name>asdddddd</oc:name>
138-
<d:getlastmodified>2022-11-08T10:45:32Z</d:getlastmodified>
139-
<d:getcontenttype>httpd/unix-directory</d:getcontenttype>
140-
<oc:permissions>RDNVCK</oc:permissions>
141-
<d:getetag />
142-
<d:resourcetype>
143-
<d:collection />
144-
</d:resourcetype>
145-
<oc:size>0</oc:size>
146-
<oc:score>0.4809828996658325</oc:score>
147-
</d:prop>
148-
<d:status>HTTP/1.1 200 OK</d:status>
149-
</d:propstat>
150-
</d:response>
151-
</d:multistatus>
113+
<?xml version="1.0" encoding="UTF-8"?>
114+
<d:multistatus xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:s="http://sabredav.org/ns">
115+
<d:response>
116+
<d:href>/remote.php/dav/files/cboxbot/eos/project/c/cernbox/New%20folder</d:href>
117+
<d:propstat>
118+
<d:prop>
119+
<oc:fileid>newproject-c!12202852</oc:fileid>
120+
<oc:file-parent>newproject-c!12202851</oc:file-parent>
121+
<oc:name>New folder</oc:name>
122+
<d:getlastmodified>2022-12-05T16:12:20Z</d:getlastmodified>
123+
<d:getcontenttype>httpd/unix-directory</d:getcontenttype>
124+
<oc:permissions>SRDNVCKZ</oc:permissions>
125+
<d:getetag />
126+
<d:resourcetype>
127+
<d:collection />
128+
</d:resourcetype>
129+
<oc:size>416606</oc:size>
130+
</d:prop>
131+
<d:status>HTTP/1.1 200 OK</d:status>
132+
</d:propstat>
133+
</d:response>
134+
<d:response>
135+
<d:href>/remote.php/dav/files/cboxbot/eos/project/c/cernbox/New%20folder/New%20file.txt</d:href>
136+
<d:propstat>
137+
<d:prop>
138+
<oc:fileid>newproject-c!12202853</oc:fileid>
139+
<oc:file-parent>newproject-c!12202852</oc:file-parent>
140+
<oc:name>New file.txt</oc:name>
141+
<d:getlastmodified>2022-12-05T16:12:20Z</d:getlastmodified>
142+
<d:getcontenttype>text/plain</d:getcontenttype>
143+
<oc:permissions>SRDNVCKZ</oc:permissions>
144+
<d:getetag />
145+
<d:resourcetype />
146+
<d:getcontentlength>30</d:getcontentlength>
147+
</d:prop>
148+
<d:status>HTTP/1.1 200 OK</d:status>
149+
</d:propstat>
150+
</d:response>
151+
</d:multistatus>
152152
`
153153
w.Write([]byte(data))
154154
w.WriteHeader(207)

pkg/eosclient/eosbinary/eosbinary.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,11 @@ func (c *Client) List(ctx context.Context, auth eosclient.Authorization, path st
720720
// List the contents of the directory given by path with depth infinity
721721
func (c *Client) SearchDir(ctx context.Context, auth eosclient.Authorization, searchString string, path string) ([]*eosclient.FileInfo, error) {
722722
// TODO(salfagem): path is truncated - i.e. /c/cernbox (not absolute)
723-
args := []string{"newfind", "--fileinfo", "-name", searchString, path}
723+
args := []string{"newfind", "--fileinfo", "--name", searchString, path}
724724
log := appctx.GetLogger(ctx)
725725
log.Debug().Msgf("eosbinary search with args: %s", args)
726726
// Safeguard #2 to prevent the search to go to undesired places:
727-
if !strings.HasPrefix(path, "/eos/project/c/cernbox") {
727+
if !strings.HasPrefix(path, "/eos/project/t/test") {
728728
log.Debug().Msgf("eosbinary - prefix doesn't match")
729729
return nil, errors.Errorf("eosclient: search path out of bounds fn=%s", path)
730730
}
@@ -741,9 +741,11 @@ func (c *Client) SearchDir(ctx context.Context, auth eosclient.Authorization, se
741741
case errtypes.NotFound, errtypes.PermissionDenied:
742742
log.Debug().Msgf("eosbinary - user had insufficient permissions to search part of the directory")
743743
default:
744-
return nil, errors.Wrapf(err, "eosclient: error listing fn=%s", path)
744+
log.Error().Msgf("ERRROR LISTING= %s", stdout)
745+
//return nil, errors.Wrapf(err, "eosclient: error listing fn=%s", path)
745746
}
746747
}
748+
log.Debug().Msgf("eos find stdout= %s", stdout)
747749
return c.parseFind(ctx, auth, path, stdout)
748750
}
749751

pkg/storage/utils/eosfs/eosfs.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ func (fs *eosfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys
13361336
// - also check that searchString not empty:
13371337
searchString = mdKeys[i+1]
13381338

1339-
log.Info().Msgf("eosfs: running search: path=%s searchString=%s", p, searchString)
1339+
log.Debug().Msgf("eosfs: running search: path=%s searchString=%s", p, searchString)
13401340

13411341
eosFileInfos, err := fs.c.SearchDir(ctx, auth, searchString, p)
13421342
if err != nil {
@@ -1353,6 +1353,7 @@ func (fs *eosfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys
13531353
}
13541354

13551355
if finfo, err := fs.convertToFileReference(ctx, eosFileInfo); err == nil {
1356+
log.Debug().Msgf("eosfs: file name from search %s", finfo.Name)
13561357
finfos = append(finfos, finfo)
13571358
}
13581359
}

0 commit comments

Comments
 (0)