mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-25 14:39:00 -05:00
delete PROPATCH favorite tests (#2689)
This commit is contained in:
+6
-2
@@ -14,10 +14,14 @@ type varField struct {
|
||||
}
|
||||
|
||||
func (f varField) ReadFrom(buffer []byte) ([]byte, error) {
|
||||
if len(buffer) < int(f.BufferOffset+uint32(f.Len)) {
|
||||
// f.Len is controlled by the sender, so we need to check that
|
||||
// it doesn't cause an overflow when added to f.BufferOffset.
|
||||
start := uint64(f.BufferOffset)
|
||||
end := start + uint64(f.Len)
|
||||
if end < start || end > uint64(len(buffer)) {
|
||||
return nil, errors.New("error reading data, varField extends beyond buffer")
|
||||
}
|
||||
return buffer[f.BufferOffset : f.BufferOffset+uint32(f.Len)], nil
|
||||
return buffer[int(start):int(end)], nil
|
||||
}
|
||||
|
||||
func (f varField) ReadStringFrom(buffer []byte, unicode bool) (string, error) {
|
||||
|
||||
Generated
Vendored
+7
@@ -155,6 +155,13 @@ func (s *svc) handleProppatch(ctx context.Context, w http.ResponseWriter, r *htt
|
||||
}
|
||||
for j := range patches[i].Props {
|
||||
propNameXML := patches[i].Props[j].XMLName
|
||||
|
||||
// favorites are now managed by the Graph API and can no longer be set using PROPPATCH. To avoid confusion, we return a 403 Forbidden when clients try to set the oc:favorites property
|
||||
if propNameXML.Local == "favorite" {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
return nil, nil, false
|
||||
}
|
||||
|
||||
// don't use path.Join. It removes the double slash! concatenate with a /
|
||||
key := fmt.Sprintf("%s/%s", patches[i].Props[j].XMLName.Space, patches[i].Props[j].XMLName.Local)
|
||||
value := string(patches[i].Props[j].InnerXML)
|
||||
|
||||
+4
-5
@@ -65,12 +65,12 @@ func (c *IDCache) DeleteByPath(ctx context.Context, path string) error {
|
||||
} else {
|
||||
err := c.kv.Purge(ctx, baseKey)
|
||||
if err != nil && err != nats.ErrKeyNotFound {
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("record", path).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not get spaceID and nodeID from cache")
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("record", baseKey).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not purge from cache")
|
||||
}
|
||||
|
||||
err = c.kv.Purge(ctx, cacheKey(spaceID, nodeID))
|
||||
if err != nil && err != nats.ErrKeyNotFound {
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("record", path).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not get spaceID and nodeID from cache")
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("record", cacheKey(spaceID, nodeID)).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not purge from cache")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,6 @@ func (c *IDCache) DeleteByPath(ctx context.Context, path string) error {
|
||||
break
|
||||
}
|
||||
key := update.Key()
|
||||
|
||||
spaceID, nodeID, ok := c.getByReverseCacheKey(ctx, key)
|
||||
if !ok {
|
||||
appctx.GetLogger(ctx).Error().Str("record", key).Msg("could not get spaceID and nodeID from cache")
|
||||
@@ -94,12 +93,12 @@ func (c *IDCache) DeleteByPath(ctx context.Context, path string) error {
|
||||
|
||||
err := c.kv.Purge(ctx, key)
|
||||
if err != nil && err != nats.ErrKeyNotFound {
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("record", key).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not get spaceID and nodeID from cache")
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("record", key).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not purge from cache")
|
||||
}
|
||||
|
||||
err = c.kv.Purge(ctx, cacheKey(spaceID, nodeID))
|
||||
if err != nil && err != nats.ErrKeyNotFound {
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("record", key).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not get spaceID and nodeID from cache")
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("record", cacheKey(spaceID, nodeID)).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not purge from cache")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
-9
@@ -37,7 +37,6 @@ import (
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
|
||||
"github.com/opencloud-eu/reva/v2/pkg/errtypes"
|
||||
@@ -813,11 +812,3 @@ func isLockFile(path string) bool {
|
||||
func isTrash(path string) bool {
|
||||
return strings.HasSuffix(path, ".trashinfo") || strings.HasSuffix(path, ".trashitem") || strings.Contains(path, ".Trash")
|
||||
}
|
||||
|
||||
func (t *Tree) AddLabel(ctx context.Context, ref *provider.Reference, userID *user.UserId, label string) error {
|
||||
return errtypes.NotSupported("AddLabel not implemented")
|
||||
}
|
||||
|
||||
func (t *Tree) RemoveLabel(ctx context.Context, ref *provider.Reference, userID *user.UserId, label string) error {
|
||||
return errtypes.NotSupported("RemoveLabel not implemented")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user