diff --git a/cmd/config.go b/cmd/config.go index 5c7efbba41..9e48cb0672 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -48,6 +48,9 @@ func addConfigFlags(flags *pflag.FlagSet) { flags.String("branding.files", "", "path to directory with images and custom styles") flags.Bool("branding.disableExternal", false, "disable external links such as GitHub links") flags.Bool("branding.disableUsedPercentage", false, "disable used disk percentage graph") + + flags.String("onlyoffice.url", "", "onlyoffice integration url") + flags.String("onlyoffice.jwtSecret", "", "onlyoffice integration secret") } //nolint:gocyclo diff --git a/files/file.go b/files/file.go index b09503ede6..534f701405 100644 --- a/files/file.go +++ b/files/file.go @@ -197,21 +197,12 @@ func (i *FileInfo) Checksum(algo string) error { } func (i *FileInfo) RealPath() string { - if realPathFs, ok := i.Fs.(interface { - RealPath(name string) (fPath string, err error) - }); ok { - realPath, err := realPathFs.RealPath(i.Path) - if err == nil { - return realPath - } - } - - return i.Path + return GetRealPath(i.Fs, i.Path) } // TODO: use constants // -//nolint:goconst +//nolint:goconst,gocyclo func (i *FileInfo) detectType(modify, saveContent, readHeader bool) error { if IsNamedPipe(i.Mode) { i.Type = "blob" @@ -270,7 +261,8 @@ func (i *FileInfo) detectType(modify, saveContent, readHeader bool) error { i.Content = string(content) } return nil - case strings.HasPrefix(mimetype, "application/vnd.openxmlformats-officedocument"): + case strings.HasPrefix(mimetype, "application/vnd.openxmlformats-officedocument"), + strings.HasPrefix(mimetype, "application/vnd.oasis.opendocument"): i.Type = "officedocument" return nil default: diff --git a/files/utils.go b/files/utils.go index f4b0365dd2..756c940f2f 100644 --- a/files/utils.go +++ b/files/utils.go @@ -3,6 +3,8 @@ package files import ( "os" "unicode/utf8" + + "github.com/spf13/afero" ) func isBinary(content []byte) bool { @@ -57,3 +59,16 @@ func IsNamedPipe(mode os.FileMode) bool { func IsSymlink(mode os.FileMode) bool { return mode&os.ModeSymlink != 0 } + +func GetRealPath(fs afero.Fs, path string) string { + if realPathFs, ok := fs.(interface { + RealPath(name string) (fPath string, err error) + }); ok { + realPath, err := realPathFs.RealPath(path) + if err == nil { + return realPath + } + } + + return path +} diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 52bc34f6cc..5f1e72225e 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -13,7 +13,6 @@ "core-js": "^3.32.0", "css-vars-ponyfill": "^2.4.8", "filesize": "^10.0.8", - "jose": "^4.13.1", "js-base64": "^3.7.5", "lodash.clonedeep": "^4.5.0", "lodash.throttle": "^4.1.1", @@ -3659,13 +3658,6 @@ "dev": true, "license": "ISC" }, - "node_modules/jose": { - "version": "4.15.4", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/panva" - } - }, "node_modules/js-base64": { "version": "3.7.5", "license": "BSD-3-Clause" diff --git a/frontend/package.json b/frontend/package.json index e04a36e014..b0ff7612c5 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -19,7 +19,6 @@ "core-js": "^3.32.0", "css-vars-ponyfill": "^2.4.8", "filesize": "^10.0.8", - "jose": "^4.13.1", "js-base64": "^3.7.5", "lodash.clonedeep": "^4.5.0", "lodash.throttle": "^4.1.1", diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index f0142bb061..bfd1b4729c 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -18,7 +18,7 @@ const enableExec = window.FileBrowser.EnableExec; const tusSettings = window.FileBrowser.TusSettings; const origin = window.location.origin; const tusEndpoint = `/api/tus`; -const onlyOffice = window.FileBrowser.OnlyOffice; +const onlyOfficeUrl = window.FileBrowser.OnlyOfficeUrl; export { name, @@ -40,5 +40,5 @@ export { tusSettings, origin, tusEndpoint, - onlyOffice, + onlyOfficeUrl, }; diff --git a/frontend/src/views/Files.vue b/frontend/src/views/Files.vue index 27c9ac5e07..693d0a5ffe 100644 --- a/frontend/src/views/Files.vue +++ b/frontend/src/views/Files.vue @@ -22,7 +22,7 @@