diff --git a/app.py b/app.py index 8a1597e..c6b8e17 100644 --- a/app.py +++ b/app.py @@ -899,33 +899,37 @@ def _remote_name(tid): return f'picopy_{tid}' +def _join_remote_path(*parts) -> str: + return '/'.join(str(p).strip('/') for p in parts if str(p).strip('/')) + + def _smb_conn(t: dict, path: str = '') -> str: """Baut ein rclone-Ziel fuer gespeicherte SMB-Targets. - Gespeicherte Ziele werden als benannte rclone-Remotes angelegt. Diese - Remote-Konfiguration ist die kanonische Quelle fuer Host, Share und Login; - der Inline-String bleibt nur als Fallback fuer unvollstaendige Legacy-Eintraege. + Bei rclone SMB ist die Freigabe der erste Pfadteil nach dem Remote: + remote:share/ordner. Die Remote-Konfiguration enthaelt Host und Login. """ + share = t.get('smb_share', '') + remote_path = _join_remote_path(share, path) if t.get('id'): - return f'{_remote_name(t["id"])}:{path}' + return f'{_remote_name(t["id"])}:{remote_path}' host = t.get('smb_host', '') - share = t.get('smb_share', '') - if not host or not share: - return f':{path}' - conn = f':smb,host={host},share={share}' + if not host: + return f':{remote_path}' + conn = f':smb,host={host}' if t.get('smb_user'): conn += f',user={t["smb_user"]}' if t.get('smb_pass'): conn += f',pass={t["smb_pass"]}' - conn += f':{path}' + conn += f':{remote_path}' return conn def configure_smb_remote(tid, host, share, user, pw): rn = _remote_name(tid) _rclone('config', 'delete', rn) - args = ['config', 'create', rn, 'smb', f'host={host}', f'share={share}'] + args = ['config', 'create', rn, 'smb', f'host={host}'] if user: args += [f'user={user}'] if pw: @@ -2380,7 +2384,7 @@ function renderUTs(){ 🖧