Merge pull request #2074 from dingodoppelt/patch-1

Trigger storage hook on sharing/delete with files backend
This commit is contained in:
Peter Bieringer
2026-04-07 17:41:32 +02:00
committed by GitHub
3 changed files with 11 additions and 7 deletions

View File

@@ -281,7 +281,8 @@ class BaseSharing:
def database_delete_sharing(self,
ShareType: str,
PathOrToken: str) -> dict:
PathOrToken: str,
User: str) -> dict:
""" delete sharing """
return {"status": "not-implemented"}
@@ -1223,7 +1224,8 @@ class BaseSharing:
if user == share['Owner']:
result = self.database_delete_sharing(
ShareType=ShareType,
PathOrToken=PathOrToken) # verification above that it is not None
PathOrToken=PathOrToken,
User=share['Owner']) # verification above that it is not None
else:
# only owner is permitted to delete a share
logger.warning(api_info + ": %r not permitted for user %r", PathOrToken, user)

View File

@@ -371,12 +371,13 @@ class Sharing(sharing.BaseSharing):
def database_delete_sharing(self,
ShareType: str,
PathOrToken: str) -> dict:
PathOrToken: str,
User: str) -> dict:
""" delete sharing """
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/sharing/%s/delete: PathOrToken=%r", ShareType, PathOrToken)
with self._storage.acquire_lock("w", path=self._sharing_db_file):
with self._storage.acquire_lock("w", User, path=self._sharing_db_file):
# lookup token
found = False
index = 0

View File

@@ -362,7 +362,8 @@ class Sharing(sharing.BaseSharing):
def database_delete_sharing(self,
ShareType: str,
PathOrToken: str) -> dict:
PathOrToken: str,
User: str) -> dict:
""" delete sharing """
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/sharing/%s/delete: PathOrToken=%r", ShareType, PathOrToken)
@@ -372,8 +373,8 @@ class Sharing(sharing.BaseSharing):
if not os.path.isfile(sharing_config_file):
return {"status": "not-found"}
# read content
with self._storage.acquire_lock("r", path=sharing_config_file):
# open writable so storage hook triggers
with self._storage.acquire_lock("w", User, path=sharing_config_file):
# read file
with open(sharing_config_file, "rb") as fb:
(version, row) = pickle.load(fb)