Skip to content

svn: Ensure to quote URLs provided as parameters to client methods

URLs provided as parameters to subvertpy.client.Client methods must be quoted or an assertion will be raised by libsvn otherwise.

Issue found while attempting to fix the loading of svn://tug.org/texlive

from urllib.parse import quote
import sys

from subvertpy import client
from subvertpy.ra import (
    Auth,
    RemoteAccess,
    get_simple_prompt_provider,
    get_username_provider,
)
auth_providers = [get_username_provider()]
client = client.Client(auth=Auth(auth_providers))

url = "svn://tug.org/texlive/trunk/Build/source/libs/teckit/docs/Calling TECkit from VB.doc"

if len(sys.argv) > 1 and sys.argv[1] == "quote":
    url = quote(url, safe=":/")

client.export(url, to="/tmp/export_test", rev=3455, peg_rev=3455, overwrite=True)
$ python test_export.py
python: ../subversion/libsvn_subr/dirent_uri.c:1562: uri_skip_ancestor: Assertion `svn_uri_is_canonical(child_uri, NULL)' failed.
Aborted
$ python test_export.py quote
$ echo $?
0

Migrated from D8786 (view on Phabricator)

Merge request reports