Skip to content

Commit

Permalink
Stop address bar from adding trailing slash to query params (#1820)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton authored Sep 29, 2024
1 parent aaa2ca1 commit 81c45f6
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ export default function AddressBar({ url, onUpdate }: AddressBarProps) {
const handleSubmit = useCallback(
function (e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
let requestedPath = input.current!.value;
// Ensure a trailing slash when requesting directory paths
const isDirectory = !requestedPath.split('/').pop()!.includes('.');
if (isDirectory && !requestedPath.endsWith('/')) {
requestedPath += '/';
}
const requestedPath = input.current!.value;
onUpdate?.(requestedPath);
input.current!.blur();
},
Expand Down

0 comments on commit 81c45f6

Please sign in to comment.