Commit 5517743
committed
forge--set-topic-labels: Properly encode old label IDs
I really messed up ID handling in the early days. Fixing that will
force all user has to recreate their local database from scratch,
which is why I still haven't done it.
Anyway, this is becoming more of a problem now that we are switching
to using GraphQL even for mutations. While the REST API usually takes
numbers and names to identify objects, the GraphQL API expects IDs.
`base64-decode-string' on our label IDsgives us a string using one of
the following two forms. (These are the "support" and "area: github"
labels of this repository.)
(base64-decode-string "Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTE0MTM3ODE5NDowNTpMYWJlbDExODMxMDE5ODg=")
=> "github.com:010:Repository141378194:05:Label1183101988"
(base64-decode-string "Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTE0MTM3ODE5NDpMQV9rd0RPQ0cxQ2tzOEFBQUFCY0hhQzdR")
=> "github.com:010:Repository141378194:LA_kwDOCG1Cks8AAAABcHaC7Q"
In the latter case we can use "LA_kwDOCG1Cks8AAAABcHaC7Q" as-is, in the
former case we have to encode "05:Label1183101988" to get the ID used on
Github, "MDU6TGFiZWwxMTgzMTAxOTg4".
(base64-encode-string "05:Label1183101988")
=> "MDU6TGFiZWwxMTgzMTAxOTg4"
It seemed like a good idea, in the "we might as well" category, to try
to decode the upstream ID and, if that succeeded, combine that (else
the original ID as-is) with our package prefix, before encoding the
combination, to avoid "double-encoding". This broke down once Github
changed the format of their IDs and we now have to deal with both their
new and legacy formats.
Closes #784.1 parent 540c026 commit 5517743
2 files changed
+15
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
2 | 8 | | |
3 | 9 | | |
4 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
955 | 955 | | |
956 | 956 | | |
957 | 957 | | |
958 | | - | |
959 | | - | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
960 | 967 | | |
961 | 968 | | |
962 | 969 | | |
| |||
0 commit comments