Fix B2 restic URL: use colon separator (b2:bucket:path) for restic 0.16.x
restic 0.16.x changed the B2 URL format to use a colon between bucket and path (b2:bucket:prefix) instead of a slash. The middlewared URL builder produces b2:/bucket/path; restic then validates the full string after 'b2:' as a bucket name, which fails because the slash is not in [a-z0-9-]. Fix the restic.py wrapper to strip the leading slash and replace the first slash with a colon: b2:/bucket/path -> b2:bucket:path. Also fix the hasattr bug in sitecustomize.py _patch_b2: hasattr() returns True for methods inherited from the base class (which raises NotImplementedError), causing the patch to be silently skipped. Use 'get_restic_config' not in cls.__dict__ instead.
This commit is contained in:
@@ -59,7 +59,7 @@ on every update) and are therefore re-applied automatically on every boot.
|
||||
|
||||
| Layer | What changes | Technique |
|
||||
|---|---|---|
|
||||
| **Backend** | `B2RcloneRemote` gains `get_restic_config()`. `restic.py` URL builder is fixed for providers with no hostname component (`b2:bucket/path` vs the broken `b2:/bucket/path`). | `sitecustomize.py` — Python's standard startup hook; no middleware files are modified on disk |
|
||||
| **Backend** | `B2RcloneRemote` gains `get_restic_config()`. `restic.py` URL builder is fixed: strips the stray leading slash and converts the slash separator to a colon (`b2:bucket:path`), which is the format restic 0.16.x expects. | Direct file patch in the overlay (primary) + `sitecustomize.py` import hook (belt-and-suspenders) |
|
||||
| **UI** | The Angular bundle's `filterByProviders` binding is widened from `["STORJ_IX"]` to `["STORJ_IX","S3","B2"]` | In-place text replacement in the compiled JS chunk; original is backed up |
|
||||
|
||||
Both changes are **fail-safe**: if a patch cannot be applied (e.g. TrueNAS
|
||||
@@ -202,7 +202,7 @@ You need three things from the task you created:
|
||||
export B2_ACCOUNT_ID="your-key-id"
|
||||
export B2_ACCOUNT_KEY="your-application-key"
|
||||
export RESTIC_PASSWORD="your-repo-password"
|
||||
REPO="b2:your-bucket/your-folder"
|
||||
REPO="b2:your-bucket:your-folder" # restic 0.16.x uses colon, not slash
|
||||
```
|
||||
|
||||
**S3-compatible (AWS S3, Wasabi, Cloudflare R2, MinIO, etc.):**
|
||||
|
||||
Reference in New Issue
Block a user