Skip to content

Commit b8ddf1e

Browse files
coolshauryaJoshua Nelson
andauthored
Check for .json extension in a non-allocating way
Co-authored-by: Joshua Nelson <[email protected]>
1 parent e9c1c5d commit b8ddf1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/web/builds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn build_list_handler(req: &mut Request) -> IronResult<Response> {
4343
let mut conn = extension!(req, Pool).get()?;
4444
let limits = ctry!(req, Limits::for_crate(&mut conn, name));
4545

46-
let is_json = req.url.path().join("/").ends_with(".json");
46+
let is_json = req.url.path().last().map_or(false, |segment| segment.ends_with(".json"));
4747

4848
let version =
4949
match match_version(&mut conn, name, req_version).and_then(|m| m.assume_exact())? {

0 commit comments

Comments
 (0)