Skip to content

Commit 229c5a9

Browse files
jyn514Joshua Nelson
authored and
Joshua Nelson
committed
Don't return 404 if .cargo-ok file exists
This was a regression introduced in #692.
1 parent f74d33d commit 229c5a9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/web/source.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl FileList {
115115

116116
// skip .cargo-ok generated by cargo
117117
if path == ".cargo-ok" {
118-
return None;
118+
continue;
119119
}
120120

121121
// look only files for req_path
@@ -261,6 +261,7 @@ pub fn source_browser_handler(req: &mut Request) -> IronResult<Response> {
261261
#[cfg(test)]
262262
mod tests {
263263
use super::*;
264+
use crate::test::{assert_success, wrapper};
264265
use serde_json::json;
265266

266267
#[test]
@@ -306,4 +307,20 @@ mod tests {
306307

307308
assert_eq!(correct_json, serde_json::to_value(&file_list).unwrap(),);
308309
}
310+
311+
#[test]
312+
fn cargo_ok_not_skipped() {
313+
wrapper(|env| {
314+
let db = env.db();
315+
db.fake_release()
316+
.name("fake")
317+
.version("0.1.0")
318+
.source_file(".cargo-ok", b"ok")
319+
.source_file("README.md", b"hello")
320+
.create()?;
321+
let web = env.frontend();
322+
assert_success("/crate/fake/0.1.0/source/", web)?;
323+
Ok(())
324+
});
325+
}
309326
}

0 commit comments

Comments
 (0)