Skip to content

Commit

Permalink
Merge pull request #3821 from aduffeck/fix-file-uploaded-event
Browse files Browse the repository at this point in the history
Fix file uploaded event
  • Loading branch information
butonic authored May 19, 2022
2 parents 7b896ef + f75616d commit b788552
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 28 deletions.
4 changes: 4 additions & 0 deletions extensions/search/pkg/search/index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package index
import (
"context"
"errors"
"math"
"path"
"strings"
"time"
Expand Down Expand Up @@ -113,6 +114,7 @@ func (i *Index) markAsDeleted(id string, deleted bool) error {
bleve.NewQueryStringQuery("Path:"+doc.Path+"/*"),
)
bleveReq := bleve.NewSearchRequest(query)
bleveReq.Size = math.MaxInt
bleveReq.Fields = []string{"*"}
res, err := i.bleveIndex.Search(bleveReq)
if err != nil {
Expand Down Expand Up @@ -188,6 +190,7 @@ func (i *Index) Move(id *sprovider.ResourceId, fullPath string) error {
bleve.NewQueryStringQuery("Path:"+oldName+"/*"),
)
bleveReq := bleve.NewSearchRequest(query)
bleveReq.Size = math.MaxInt
bleveReq.Fields = []string{"*"}
res, err := i.bleveIndex.Search(bleveReq)
if err != nil {
Expand Down Expand Up @@ -294,6 +297,7 @@ func fieldsToEntity(fields map[string]interface{}) *indexDocument {
Mtime: fields["Mtime"].(string),
MimeType: fields["MimeType"].(string),
Type: uint64(fields["Type"].(float64)),
Deleted: fields["Deleted"].(bool),
}
return doc
}
Expand Down
10 changes: 8 additions & 2 deletions extensions/storage-system/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ type Config struct {
Log *Log `yaml:"log"`
Debug Debug `yaml:"debug"`

GRPC GRPCConfig `yaml:"grpc"`
HTTP HTTPConfig `yaml:"http"`
GRPC GRPCConfig `yaml:"grpc"`
HTTP HTTPConfig `yaml:"http"`
Events Events `yaml:"events"`

TokenManager *TokenManager `yaml:"token_manager"`
Reva *Reva `yaml:"reva"`
Expand Down Expand Up @@ -77,3 +78,8 @@ type OCISDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root" env:"STORAGE_SYSTEM_OCIS_ROOT"`
}

type Events struct {
Addr string `yaml:"endpoint" env:"STORAGE_SYSTEM_EVENTS_ENDPOINT" desc:"the address of the streaming service"`
ClusterID string `yaml:"cluster" env:"STORAGE_SYSTEM_EVENTS_CLUSTER" desc:"the clusterID of the streaming service. Mandatory when using nats"`
}
14 changes: 8 additions & 6 deletions extensions/storage-users/pkg/revaconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} {
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": cfg.HTTP.Prefix,
"driver": cfg.Driver,
"drivers": UserDrivers(cfg),
"timeout": 86400,
"insecure": cfg.DataProviderInsecure,
"disable_tus": false,
"prefix": cfg.HTTP.Prefix,
"driver": cfg.Driver,
"drivers": UserDrivers(cfg),
"timeout": 86400,
"insecure": cfg.DataProviderInsecure,
"disable_tus": false,
"nats_address": cfg.Events.Addr,
"nats_clusterID": cfg.Events.ClusterID,
},
},
},
Expand Down
17 changes: 0 additions & 17 deletions extensions/webdav/pkg/service/v0/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,6 @@ func matchToPropResponse(ctx context.Context, match *searchmsg.Match) (*propfind
Prop: []prop.PropertyXML{},
}

// <oc:permissions>RDNVW</oc:permissions>
// <oc:favorite>0</oc:favorite>
// <oc:owner-id>demo</oc:owner-id>
// <oc:owner-display-name>demo</oc:owner-display-name>
// <oc:share-types/>
// <oc:privatelink>https://demo.owncloud.com/f/7</oc:privatelink>
// <d:getcontenttype>application/pdf</d:getcontenttype>
// <d:resourcetype/>
// <oc:downloadURL/>
// done:
// <oc:fileid>7</oc:fileid>
// <oc:size>6668668</oc:size>
// <d:getcontentlength>6668668</d:getcontentlength>
// <d:getetag>"0cdcdd1bb13a8fed3e54d3b2325dc97c"</d:getetag>
// <d:getlastmodified>Mon, 25 Apr 2022 06:48:26 GMT</d:getlastmodified>

propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:fileid", match.Entity.Id.StorageId+"!"+match.Entity.Id.OpaqueId))
propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("d:getetag", match.Entity.Etag))
propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("d:getlastmodified", match.Entity.LastModifiedTime.AsTime().Format(time.RFC3339)))
Expand All @@ -138,7 +122,6 @@ func matchToPropResponse(ctx context.Context, match *searchmsg.Match) (*propfind
prop.Escaped("d:getcontentlength", size),
)
}
// TODO find name for score property
score := strconv.FormatFloat(float64(match.Score), 'f', -1, 64)
propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:score", score))

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/blevesearch/bleve_index_api v1.0.1
github.com/coreos/go-oidc/v3 v3.2.0
github.com/cs3org/go-cs3apis v0.0.0-20220412090512-93c5918b4bde
github.com/cs3org/reva/v2 v2.3.2-0.20220513093820-4f179b727de6
github.com/cs3org/reva/v2 v2.3.2-0.20220518201235-fc42c1a84d5a
github.com/disintegration/imaging v1.6.2
github.com/go-chi/chi/v5 v5.0.7
github.com/go-chi/cors v1.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD9
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4=
github.com/cs3org/go-cs3apis v0.0.0-20220412090512-93c5918b4bde h1:WrD9O8ZaWvsm0eBzpzVBIuczDhqVq50Nmjc7PGHHA9Y=
github.com/cs3org/go-cs3apis v0.0.0-20220412090512-93c5918b4bde/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/reva/v2 v2.3.2-0.20220513093820-4f179b727de6 h1:SsL8/Uu/h8fYxi44iEg8MbziujeyVMZdwZECeaoMBww=
github.com/cs3org/reva/v2 v2.3.2-0.20220513093820-4f179b727de6/go.mod h1:uGeTncJa3FISh8AERkbZYVNXFV40PjYyRht5L09i+LQ=
github.com/cs3org/reva/v2 v2.3.2-0.20220518201235-fc42c1a84d5a h1:GkOtCxtt/k4ZoDyFnnKuONDFp7o3yYhKHFydnZvhnpI=
github.com/cs3org/reva/v2 v2.3.2-0.20220518201235-fc42c1a84d5a/go.mod h1:uGeTncJa3FISh8AERkbZYVNXFV40PjYyRht5L09i+LQ=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
Expand Down

0 comments on commit b788552

Please sign in to comment.