Commit 41dc7bf
committed
fix: handle tags like debian/2%2.6-21 as identifiers
Git refnames are relatively free-form and can contain all sort for
special characters, not just `/ and `#`, see
http://git-scm.com/docs/git-check-ref-format
In particular, Debian's DEP-14 standard for storing packaging in git
repositories mandates the use of the `%` character in tags in some
cases like `debian/2%2.6-21`.
Unfortunately python-gitlab currently only escapes `/` to `%2F` and in
some cases `#` to `%23`. This means that when using the commit API to
retrieve information about the `debian/2%2.6-21` tag only the slash is
escaped before being inserted in the URL path and the `%` is left
untouched, resulting in something like
`/api/v4/projects/123/repository/commits/debian%2F2%2.6-21`. When
urllib3 seees that it detects the invalid `%` escape and then urlencodes
the whole string, resulting in
`/api/v4/projects/123/repository/commits/debian%252F2%252.6-21`, where
the original `/` got escaped twice and produced `%252F`.
To avoid the issue, fully urlencode identifiers and parameters to avoid
the urllib3 auto-escaping in all cases.
Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>1 parent aa13214 commit 41dc7bfCopy full SHA for 41dc7bf
File tree
Expand file treeCollapse file tree
2 files changed
+11
-3
lines changedOpen diff view settings
Filter options
- gitlab
- tests
Expand file treeCollapse file tree
2 files changed
+11
-3
lines changedOpen diff view settings
Collapse file
+8Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
27 | 27 | |
28 | 28 | |
29 | 29 | |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
30 | 34 | |
31 | 35 | |
32 | 36 | |
| ||
48 | 52 | |
49 | 53 | |
50 | 54 | |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
51 | 59 | |
52 | 60 | |
53 | 61 | |
|
Collapse file
+3-3Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | | - |
| 19 | + |
20 | 20 | |
21 | 21 | |
22 | 22 | |
| ||
57 | 57 | |
58 | 58 | |
59 | 59 | |
60 | | - |
| 60 | + |
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | |
67 | | - |
| 67 | + |
68 | 68 | |
69 | 69 | |
70 | 70 | |
|
0 commit comments