Merge pull request #11814 from owncloud/fix/disabled-extensions-without-dots

fix(collaboration): [OCISDEV-484] remove leading dot from file extension
This commit is contained in:
Lukas Hirt authored and GitHub committed 2025-12-15 16:41:01 +01:00
commit 401d5015ae
2 files changed
+8 -1

No files matched your search

@@ -0,0 +1,6 @@
Bugfix: Remove leading dot before checking disabled extension
We have fixed a bug where the leading dot was not removed before checking if an extension is disabled.
The original behavior would have caused the `COLLABORATION_WOPI_DISABLED_EXTENSIONS` config to be ignored.
https://github.com/owncloud/ocis/pull/11814
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"slices"
"strings"
registryv1beta1 "github.com/cs3org/go-cs3apis/cs3/app/registry/v1beta1"
gatewayv1beta1 "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
@@ -41,7 +42,7 @@ func RegisterAppProvider(
mimeTypesMap := make(map[string]bool)
for _, extensions := range appUrls {
for ext := range extensions {
if slices.Contains(cfg.Wopi.DisabledExtensions, ext) {
if slices.Contains(cfg.Wopi.DisabledExtensions, strings.TrimPrefix(ext, ".")) {
logger.Debug().Str("AppName", cfg.App.Name).Str("Extension", ext).Msg("Skipping disabled extension")
continue
}