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

Remove notifications key from ocs response #1819

Merged
merged 6 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/disable-notifications.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Disable notifications

The presence of the key `notifications` in the capabilities' response would cause clients to attempt to poll the notifications endpoint, which is not yet supported. To prevent the unnecessary bandwidth we are disabling this altogether.

https://github.com/cs3org/reva/pull/1819
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocs/data/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Capabilities struct {
Files *CapabilitiesFiles `json:"files" xml:"files" mapstructure:"files"`
Dav *CapabilitiesDav `json:"dav" xml:"dav"`
FilesSharing *CapabilitiesFilesSharing `json:"files_sharing" xml:"files_sharing" mapstructure:"files_sharing"`
Notifications *CapabilitiesNotifications `json:"notifications" xml:"notifications"`
Notifications *CapabilitiesNotifications `json:"notifications,omitempty" xml:"notifications,omitempty"`
}

// CapabilitiesCore holds webdav config
Expand Down Expand Up @@ -178,7 +178,7 @@ type CapabilitiesFilesSharingFederation struct {

// CapabilitiesNotifications holds a list of notification endpoints
type CapabilitiesNotifications struct {
Endpoints []string `json:"ocs-endpoints" xml:"ocs-endpoints>element" mapstructure:"endpoints"`
Endpoints []string `json:"ocs-endpoints,omitempty" xml:"ocs-endpoints>element,omitempty" mapstructure:"endpoints"`
}

// Version holds version information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ func (h *Handler) Init(c *config.Config) {

// notifications

if h.c.Capabilities.Notifications == nil {
h.c.Capabilities.Notifications = &data.CapabilitiesNotifications{}
}
if h.c.Capabilities.Notifications.Endpoints == nil {
h.c.Capabilities.Notifications.Endpoints = []string{"list", "get", "delete"}
}
// if h.c.Capabilities.Notifications == nil {
// h.c.Capabilities.Notifications = &data.CapabilitiesNotifications{}
// }
// if h.c.Capabilities.Notifications.Endpoints == nil {
// h.c.Capabilities.Notifications.Endpoints = []string{"list", "get", "delete"}
// }

// version

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestMarshal(t *testing.T) {
},
}

jsonExpect := `{"capabilities":{"core":null,"checksums":null,"files":null,"dav":null,"files_sharing":{"api_enabled":true,"resharing":false,"group_sharing":false,"auto_accept_share":false,"share_with_group_members_only":false,"share_with_membership_groups_only":false,"search_min_length":0,"default_permissions":0,"user_enumeration":null,"federation":null,"public":null,"user":null},"notifications":null},"version":null}`
jsonExpect := `{"capabilities":{"core":null,"checksums":null,"files":null,"dav":null,"files_sharing":{"api_enabled":true,"resharing":false,"group_sharing":false,"auto_accept_share":false,"share_with_group_members_only":false,"share_with_membership_groups_only":false,"search_min_length":0,"default_permissions":0,"user_enumeration":null,"federation":null,"public":null,"user":null}},"version":null}`
xmlExpect := `<CapabilitiesData><capabilities><files_sharing><api_enabled>1</api_enabled><resharing>0</resharing><group_sharing>0</group_sharing><auto_accept_share>0</auto_accept_share><share_with_group_members_only>0</share_with_group_members_only><share_with_membership_groups_only>0</share_with_membership_groups_only><search_min_length>0</search_min_length><default_permissions>0</default_permissions></files_sharing></capabilities></CapabilitiesData>`

jsonData, err := json.Marshal(&cd)
Expand Down