Files
romm/backend/handler/filesystem/cloud_sync_blob_handler.py
Georges-Antoine Assi d5d9196db3 refactor(cloud-sync): apply simplify pass
- Hoist the file MD5 onto FSHandler; drop the blob handler copy
- Share path splitting, slot recency, cached MD5 and ROM visibility helpers
- Remove dead code (get_state_by_path, RomFile.file_ids, unused params)
- Scope WebDAV rom listing to one query; look up a single platform by slug
- Query saves once per manifest and batch ROM name resolution
- Read only the requested PSP bundle member; hash bundles from memory
- Single separator-safe lexical check in validate_path; same joined-path
  validation in write_file_streamed
- Stop stripping + on ROM rename, the download path encodes it (#2746)
- Trim comments to the repo's comment rules

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 11:55:32 -04:00

25 lines
762 B
Python

"""Opaque per-user storage for the Cloud Sync categories no ROM owns: config/,
thumbnails/ and system/."""
from config import CLOUD_SYNC_BLOB_BASE_PATH
from .base_handler import FSHandler
class FSCloudSyncBlobHandler(FSHandler):
def __init__(self) -> None:
super().__init__(base_path=CLOUD_SYNC_BLOB_BASE_PATH)
async def list_blob_paths(self, prefix: str) -> list[str]:
"""Posix paths of every file under `prefix` (relative to the blob root),
relative to `prefix` itself."""
try:
root = self.validate_path(prefix)
except ValueError:
return []
if not root.is_dir():
return []
return [p.relative_to(root).as_posix() for p in root.rglob("*") if p.is_file()]