Skip to content

Commit 6d848a5

Browse files
committed
remove unnecessary normalization
1 parent e3758c5 commit 6d848a5

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

packages/next/src/server/dev/middleware-turbopack.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,17 +432,14 @@ export function getOverlayMiddleware({
432432

433433
let openEditorResult
434434
if (isAppRelativePath) {
435-
const relativeFilePath = (searchParams.get('file') || '').replace(
436-
'/',
437-
path.sep
438-
)
439-
const filePath = path.join(
435+
const relativeFilePath = searchParams.get('file') || ''
436+
const absoluteFilePath = path.join(
440437
projectPath,
441438
'app',
442439
isSrcDir ? 'src' : '',
443440
relativeFilePath
444441
)
445-
openEditorResult = await openFileInEditor(filePath, 1, 1)
442+
openEditorResult = await openFileInEditor(absoluteFilePath, 1, 1)
446443
} else {
447444
const frame = createStackFrame(searchParams)
448445
if (!frame) return middlewareResponse.badRequest(res)

packages/next/src/server/dev/middleware-webpack.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -581,17 +581,14 @@ export function getOverlayMiddleware(options: {
581581
let openEditorResult
582582
const isAppRelativePath = searchParams.get('isAppRelativePath') === '1'
583583
if (isAppRelativePath) {
584-
const relativeFilePath = (searchParams.get('file') || '').replace(
585-
'/',
586-
path.sep
587-
)
588-
const filePath = path.join(
584+
const relativeFilePath = searchParams.get('file') || ''
585+
const absoluteFilePath = path.join(
589586
rootDirectory,
590587
'app',
591588
isSrcDir ? 'src' : '',
592589
relativeFilePath
593590
)
594-
openEditorResult = await openFileInEditor(filePath, 1, 1)
591+
openEditorResult = await openFileInEditor(absoluteFilePath, 1, 1)
595592
} else {
596593
// frame files may start with their webpack layer, like (middleware)/middleware.js
597594
const filePath = path.resolve(

0 commit comments

Comments
 (0)