fix(sharing): strip share permission before comparing to bundled perms

Handle backward compatibility when config.defaultPermissions includes
the SHARE permission (value 31) which was previously part of
BUNDLED_PERMISSIONS.ALL. Now that ALL no longer includes SHARE, the
comparison must strip SHARE before checking against bundled permissions.

This fixes an issue where the Advanced Settings section would be
auto-expanded for new shares, causing a toggle to close it instead
of opening it.

Signed-off-by: nfebe <fenn25.fn@gmail.com>
This commit is contained in:
nfebe 2026-01-20 12:48:06 +01:00
parent 8526999ad5
commit 2cdbd7fa15
2 changed files with 9 additions and 3 deletions

View file

@ -11,6 +11,7 @@ import debounce from 'debounce'
import PQueue from 'p-queue'
import { fetchNode } from '../../../files/src/services/WebdavClient.ts'
import {
ATOMIC_PERMISSIONS,
BUNDLED_PERMISSIONS,
} from '../lib/SharePermissionsToolBox.js'
import Share from '../models/Share.ts'
@ -139,10 +140,12 @@ export default {
hasCustomPermissions() {
const bundledPermissions = [
BUNDLED_PERMISSIONS.ALL,
BUNDLED_PERMISSIONS.ALL_FILE,
BUNDLED_PERMISSIONS.READ_ONLY,
BUNDLED_PERMISSIONS.FILE_DROP,
]
return !bundledPermissions.includes(this.share.permissions)
const permissionsWithoutShare = this.share.permissions & ~ATOMIC_PERMISSIONS.SHARE
return !bundledPermissions.includes(permissionsWithoutShare)
},
maxExpirationDateEnforced() {
if (this.isExpiryDateEnforced) {

View file

@ -1021,8 +1021,11 @@ export default {
handleDefaultPermissions() {
if (this.isNewShare) {
const defaultPermissions = this.config.defaultPermissions
if (defaultPermissions === BUNDLED_PERMISSIONS.READ_ONLY || defaultPermissions === BUNDLED_PERMISSIONS.ALL) {
this.sharingPermission = defaultPermissions.toString()
const permissionsWithoutShare = defaultPermissions & ~ATOMIC_PERMISSIONS.SHARE
if (permissionsWithoutShare === BUNDLED_PERMISSIONS.READ_ONLY
|| permissionsWithoutShare === BUNDLED_PERMISSIONS.ALL
|| permissionsWithoutShare === BUNDLED_PERMISSIONS.ALL_FILE) {
this.sharingPermission = permissionsWithoutShare.toString()
} else {
this.sharingPermission = 'custom'
this.share.permissions = defaultPermissions