Add scripts/patch-weboffice-collabora-yaml.py

This commit is contained in:
2026-04-09 18:59:37 +00:00
parent 8005b51789
commit 318e6d0cd0

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env python3
from ruamel.yaml import YAML
from pathlib import Path
import sys
yaml = YAML()
yaml.preserve_quotes = True
path = Path(sys.argv[1])
with path.open("r") as f:
data = yaml.load(f)
extra = data["services"]["collabora"]["environment"]["extra_params"]
# normalize to string
extra_str = str(extra)
if "--o:hexify_embedded_urls=true" in extra_str:
print("[patch-weboffice-collabora-yaml] already patched")
sys.exit(0)
lines = extra_str.splitlines()
lines.append(" --o:hexify_embedded_urls=true")
data["services"]["collabora"]["environment"]["extra_params"] = "\n".join(lines)
with path.open("w") as f:
yaml.dump(data, f)
print("[patch-weboffice-collabora-yaml] patched successfully")