feat: extensionless URL resolution in preview server#1824
Merged
bajrangCoder merged 2 commits intoAcode-Foundation:mainfrom Jan 16, 2026
Merged
Conversation
Links like <a href="about"> now resolve to about.html or about/index.html Fixes: Acode-Foundation#1739
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
Greptile SummaryAdded extensionless URL resolution to the preview server. When a request comes in without a file extension (e.g.,
The implementation is straightforward and solves the requested feature. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant Server as Preview Server
participant EM as EditorManager
participant FS as FileSystem
Browser->>Server: GET /about (no extension)
Server->>Server: Extract reqPath = "about"
Server->>Server: Detect !ext && pathName
Note over Server: Try path.html first
Server->>EM: getFile("pathName/about.html")
alt File loaded and unsaved in editor
EM-->>Server: Return editor file
Server->>Server: sendHTML(file.session.getValue())
Server-->>Browser: 200 OK (HTML from editor)
else Not in editor
Server->>FS: fsOperation("pathName/about.html").exists()
alt about.html exists
FS-->>Server: true
Server->>Server: sendFileContent(htmlUrl, MIMETYPE_HTML)
Server-->>Browser: 200 OK (about.html)
else about.html not found
FS-->>Server: false
Note over Server: Try path/index.html fallback
Server->>FS: fsOperation("pathName/about/index.html").exists()
alt about/index.html exists
FS-->>Server: true
Server->>Server: sendFileContent(indexUrl, MIMETYPE_HTML)
Server-->>Browser: 200 OK (about/index.html)
else index.html not found
FS-->>Server: false
Server->>Server: error(reqId)
Server-->>Browser: 404 Not Found
end
end
end
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Links like
<a href="about">now resolve toabout.htmlorabout/index.htmlFixes: #1739