Skip to content

Commit 1c90319

Browse files
committed
worker/readmes: Save the README of build metadata containing versions to escaped path too
1 parent 7e22049 commit 1c90319

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

src/tests/http-data/krate_publish_new_krate_with_readme_and_plus_version.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,89 @@
248248
"body": ""
249249
}
250250
},
251+
{
252+
"request": {
253+
"uri": "http://127.0.0.1:19000/crates-test/readmes/foo_readme/foo_readme-1.0.0%2Bfoo.html",
254+
"method": "PUT",
255+
"headers": [
256+
[
257+
"accept",
258+
"*/*"
259+
],
260+
[
261+
"accept-encoding",
262+
"gzip"
263+
],
264+
[
265+
"content-length",
266+
"0"
267+
],
268+
[
269+
"content-type",
270+
"text/html"
271+
]
272+
],
273+
"body": ""
274+
},
275+
"response": {
276+
"status": 200,
277+
"headers": [
278+
[
279+
"accept-ranges",
280+
"bytes"
281+
],
282+
[
283+
"content-length",
284+
"0"
285+
],
286+
[
287+
"content-security-policy",
288+
"block-all-mixed-content"
289+
],
290+
[
291+
"date",
292+
"Tue, 13 Jun 2023 23:04:33 GMT"
293+
],
294+
[
295+
"etag",
296+
"\"d41d8cd98f00b204e9800998ecf8427e\""
297+
],
298+
[
299+
"server",
300+
"MinIO"
301+
],
302+
[
303+
"strict-transport-security",
304+
"max-age=31536000; includeSubDomains"
305+
],
306+
[
307+
"vary",
308+
"Origin"
309+
],
310+
[
311+
"vary",
312+
"Accept-Encoding"
313+
],
314+
[
315+
"x-amz-id-2",
316+
"dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8"
317+
],
318+
[
319+
"x-amz-request-id",
320+
"17685A6A61677EBE"
321+
],
322+
[
323+
"x-content-type-options",
324+
"nosniff"
325+
],
326+
[
327+
"x-xss-protection",
328+
"1; mode=block"
329+
]
330+
],
331+
"body": ""
332+
}
333+
},
251334
{
252335
"request": {
253336
"uri": "http://127.0.0.1:19000/crates-test/readmes/foo_readme/foo_readme-1.0.0+foo.html",

src/worker/readmes.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,19 @@ pub fn perform_render_and_upload_readme(
3434

3535
tracing::Span::current().record("krate.name", tracing::field::display(&crate_name));
3636

37+
if vers.contains('+') {
38+
let escaped_version = vers.replace('+', "%2B");
39+
env.uploader.upload_readme(
40+
env.http_client(),
41+
&crate_name,
42+
&escaped_version,
43+
rendered.clone(),
44+
)?;
45+
}
46+
3747
env.uploader
3848
.upload_readme(env.http_client(), &crate_name, &vers, rendered)?;
49+
3950
Ok(())
4051
})
4152
}

0 commit comments

Comments
 (0)