Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/launch-editor-middleware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = (specifiedEditor, srcRoot, onErrorCallback) => {
res.statusCode = 500
res.end(`launch-editor-middleware: required query param "file" is missing.`)
} else {
launch(path.resolve(srcRoot, file), specifiedEditor, onErrorCallback)
const resolved = file.startsWith('file://') ? file : path.resolve(srcRoot, file)
Copy link
Contributor

@dominikg dominikg Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be

const resolved = file.startsWith('file://') ? file : `file://${path.resolve(srcRoot, file)}`

(potentially needs special handling for drive letter on windows too)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

launch-editor supports normal paths, so it should be fine.

const parsed = parseFile(file)

if (file.startsWith('file://')) {
file = require('url').fileURLToPath(file)
}

launch(resolved, specifiedEditor, onErrorCallback)
res.end()
}
}
Expand Down