Skip to content

test: repository path#9408

Open
SebastianSpeitel wants to merge 1 commit intoborgbackup:masterfrom
SebastianSpeitel:repo-path
Open

test: repository path#9408
SebastianSpeitel wants to merge 1 commit intoborgbackup:masterfrom
SebastianSpeitel:repo-path

Conversation

@SebastianSpeitel
Copy link

Description

I found a bug, where a repository with a path containing @ can't be used.
This adds a test which reproduces the issue.

Checklist

  • PR is against master (or maintenance branch if only applicable there)
  • New code has tests and docs where appropriate
  • Tests pass (run tox or the relevant test subset)
  • Commit messages are clean and reference related issues

@codecov
Copy link

codecov bot commented Feb 23, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
1676 1 1675 345
View the top 1 failed test(s) by shortest run time
src.borg.testsuite.repository_test::test_repository_path
Stack Traces | 0.005s run time
tmp_path = PosixPath('.../pytest-0/popen-gw3/test_repository_path0')

    def test_repository_path(tmp_path):
        location = os.fspath(tmp_path / "@repo")
        repository = Repository(location)
>       assert repository.url.endswith("@repo")
E       AssertionError: assert False
E        +  where False = <built-in method endswith of str object at 0x7f968b2757b0>('@repo')
E        +    where <built-in method endswith of str object at 0x7f968b2757b0> = 'file://.../pytest-0/popen-gw3/test_repository_path0/%40repo'.endswith
E        +      where 'file://.../pytest-0/popen-gw3/test_repository_path0/%40repo' = <Repository proto='file', user=None, pass=None, host=None, port=None, path='.../pytest-0/popen-gw3/test_repository_path0/%40repo'>.url

.../borg/testsuite/repository_test.py:101: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Feb 24, 2026

In the failing test, the repo url looks like:

file:///tmp/pytest-of-runner/pytest-0/test_repository_path0/%40repo

We have an issue discussing about urlquoting: #8585

From Gemini:

Handling the @ Character

According to RFC 3986, the @ character is a "sub-delimiter" and is technically allowed to appear unencoded within a path segment.

However, in many systems (especially in Python or when passing paths to CLI tools), you can safely use the percent-encoded version to avoid any ambiguity with the "userinfo" part of a URL (e.g., user@host).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants