sim icon indicating copy to clipboard operation
sim copied to clipboard

fix: prevent URL encoding for spaces

Open Chadha93 opened this issue 2 months ago • 2 comments

Summary

Brief description of what this PR does and why. fix: use replaceAll for footer block URLs to handle multi-word names which fixes issue where "Human In The Loop" was generating /blocks/human-in%20the%20loop instead of /blocks/human-in-the-loop by replacing only the first space. Changed to replaceAll(' ', '-') to handle all spaces correctly.

Fixes #(issue)

Type of Change

  • [x] Bug fix
  • [ ] New feature
  • [ ] Breaking change
  • [ ] Documentation
  • [ ] Other: ___________

Testing

How has this been tested? What should reviewers focus on? Click on Human In The Loop from site's footer block it will redirect to 404 - https://docs.sim.ai/blocks/human-in%20the%20loop

Checklist

  • [x] Code follows project style guidelines
  • [x] Self-reviewed my changes
  • [x] Tests added/updated and passing
  • [x] No new warnings introduced
  • [x] I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Chadha93 avatar Dec 15 '25 10:12 Chadha93

@Chadha93 is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Dec 15 '25 10:12 vercel[bot]

Greptile Overview

Greptile Summary

Fixed URL generation for multi-word block names in the footer component.

  • Changed replace(' ', '-') to replaceAll(' ', '-') for block URLs to handle all spaces
  • Previously, "Human In The Loop" generated /blocks/human-in%20the%20loop (404 error)
  • Now correctly generates /blocks/human-in-the-loop

Confidence Score: 5/5

  • This PR is safe to merge - it's a minimal one-line bug fix using standard JavaScript API
  • The change is a straightforward fix replacing .replace() with .replaceAll() to handle multiple spaces in block names. The method is well-supported across all modern browsers and the change is localized to a single line with no side effects.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/(landing)/components/footer/footer.tsx 5/5 Changed .replace(' ', '-') to .replaceAll(' ', '-') to correctly handle multi-word block names like "Human In The Loop"

Sequence Diagram

sequenceDiagram
    participant User
    participant Footer
    participant BlockLink
    participant DocsURL

    User->>Footer: Renders footer component
    Footer->>BlockLink: Maps FOOTER_BLOCKS array
    BlockLink->>BlockLink: block.toLowerCase()
    BlockLink->>BlockLink: replaceAll(' ', '-')
    Note right of BlockLink: "Human In The Loop" → "human-in-the-loop"
    BlockLink->>DocsURL: Generate URL
    DocsURL-->>User: https://docs.sim.ai/blocks/human-in-the-loop

greptile-apps[bot] avatar Dec 15 '25 10:12 greptile-apps[bot]

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs Building Building Preview, Comment Dec 15, 2025 6:51pm

vercel[bot] avatar Dec 15 '25 18:12 vercel[bot]