Skip to content

rustdoc JSON: set public access so files can be downloaded via static.docs.rs #2829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/docbuilder/rustwide_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,10 +911,10 @@ impl RustwideBuilder {

for format_version in [format_version, RustdocJsonFormatVersion::Latest] {
let _span = info_span!("store_json", %format_version).entered();
self.storage.store_one(
rustdoc_json_path(name, version, target, format_version),
compressed_json.clone(),
)?;
let path = rustdoc_json_path(name, version, target, format_version);

self.storage.store_one(&path, compressed_json.clone())?;
self.storage.set_public_access(&path, true)?;
}

Ok(())
Expand Down Expand Up @@ -1467,12 +1467,14 @@ mod tests {
// other targets too
for target in DEFAULT_TARGETS {
// check if rustdoc json files exist for all targets
assert!(storage.exists(&rustdoc_json_path(
let path = rustdoc_json_path(
crate_,
version,
target,
RustdocJsonFormatVersion::Latest
))?);
RustdocJsonFormatVersion::Latest,
);
assert!(storage.exists(&path)?);
assert!(storage.get_public_access(&path)?);

let json_prefix = format!("rustdoc-json/{crate_}/{version}/{target}/");
let mut json_files: Vec<_> = storage
Expand All @@ -1481,8 +1483,6 @@ mod tests {
.map(|f| f.strip_prefix(&json_prefix).unwrap().to_owned())
.collect();
json_files.sort();
dbg!(&json_prefix);
dbg!(&json_files);
assert_eq!(
json_files,
vec![
Expand Down
Loading