Skip to content

Commit cbebc1a

Browse files
committed
feature: redirect when space in crate name
1 parent ab3cb54 commit cbebc1a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/routes/crate.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ export default class CrateRoute extends Route {
1010

1111
async model(params, transition) {
1212
let crateName = params.crate_id;
13+
if (crateName.trim() != crateName) {
14+
// If the crate name has leading/trailing whitespace, redirect to the trimmed version.
15+
this.router.transitionTo('crate', crateName.trim());
16+
return;
17+
}
1318

1419
try {
1520
// We would like the peeked crate to include information (such as keywords) for further

0 commit comments

Comments
 (0)