Skip to content

fix: normalize forward slashes to backslashes for Windows directory matching#28240

Closed
jcompagner wants to merge 1 commit into
anomalyco:devfrom
Servoy:fix/windows-directory-slash-normalization
Closed

fix: normalize forward slashes to backslashes for Windows directory matching#28240
jcompagner wants to merge 1 commit into
anomalyco:devfrom
Servoy:fix/windows-directory-slash-normalization

Conversation

@jcompagner
Copy link
Copy Markdown

@jcompagner jcompagner commented May 18, 2026

Issue for this PR

#28242

Closes #28242

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

On Windows, the web UI frontend normalizes paths to forward slashes (C:/Users/...) but the database stores backslashes (C:\Users...). This caused session list queries to return 0 results after a page refresh, because the directory filter did an exact string match.

Add normalizeDirectory() that converts forward slashes to backslashes on Windows when the path looks like a drive letter path (X:/...). Apply it in the workspace-routing middleware and the session list handler.

How did you verify your code works?

i run the dev server and opened a project made some sessions and just refresh the page
Or just restart the server and let the browser reload itself, mostly on windows you loose all the sessions (or keep only 1 for some reason)

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels May 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found several related PRs addressing similar Windows path normalization issues:

Potential Related PRs:

  1. fix: normalize Windows session directory filters #26463 - "fix: normalize Windows session directory filters"

    • Directly addresses Windows session directory filtering, same core issue
  2. fix: sessions missing from sidebar on Windows due to path separator mismatch #23862 - "fix: sessions missing from sidebar on Windows due to path separator mismatch"

    • Addresses sessions disappearing on Windows due to path separator issues, same root cause
  3. fix: normalize Windows desktop session paths #26580 - "fix: normalize Windows desktop session paths"

    • Addresses Windows session path normalization
  4. fix(app): normalize watcher paths #24341 - "fix(app): normalize watcher paths"

    • Related path normalization work on Windows

These PRs appear to be addressing the same or very similar issues with Windows path separators causing session lookup failures. Recommend checking PR #26463 and #23862 in particular as they seem most directly related to the current issue (PR #28240).

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

…atching

On Windows, the web UI frontend normalizes paths to forward slashes
(C:/Users/...) but the database stores backslashes (C:\Users\...).
This caused session list queries to return 0 results after a page
refresh, because the directory filter did an exact string match.

Add normalizeDirectory() that converts forward slashes to backslashes
on Windows when the path looks like a drive letter path (X:/...).
Apply it in the workspace-routing middleware and the session list handler.
@jcompagner jcompagner force-pushed the fix/windows-directory-slash-normalization branch from 1775290 to 410e86f Compare May 18, 2026 22:19
@jcompagner jcompagner closed this May 18, 2026
@jcompagner jcompagner deleted the fix/windows-directory-slash-normalization branch May 18, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On windows we have a problem with "opencode web" because forward and backward slashes are mixed up

1 participant