Commit 75ff3b7
committed
Don't decode YAML responses before parsing them in get_artifact
Taskcluster sends those without a content-type which means that requests
assumes they're latin1 text, which they might not be as taskgraph uploads
its YAMLs encoded as UTF-8. While decoding UTF-8 as latin1 works most of
the time, if the commit message passed in a parameters.yml contains a
special character, then it will return a garbled mess which the yaml
library will reject.
By passing the raw bytes instead of decoding them, we sidestep the
problem entirely, delegating the decoding to the YAML library which
supports both utf-8 and utf-16s.
From the documentation for `yaml.load`
> A byte string or a file must be encoded with utf-8, utf-16-be or
> utf-16-le encoding. yaml.load detects the encoding by checking the BOM
> (byte order mark) sequence at the beginning of the string/file. If no
> BOM is present, the utf-8 encoding is assumed.1 parent efb7fc0 commit 75ff3b7
File tree
2 files changed
+16
-1
lines changed- src/taskgraph/util
- test
2 files changed
+16
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
157 | 172 | | |
158 | 173 | | |
159 | 174 | | |
| |||
0 commit comments