Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path.format({base: ''}) inconsistency with Node #4005

Closed
vjpr opened this issue Aug 5, 2023 · 1 comment · Fixed by #4064
Closed

path.format({base: ''}) inconsistency with Node #4005

vjpr opened this issue Aug 5, 2023 · 1 comment · Fixed by #4064
Labels
bug Something isn't working node.js Compatibility with Node.js APIs

Comments

@vjpr
Copy link
Contributor

vjpr commented Aug 5, 2023

What version of Bun is running?

0.7.3

What platform is your computer?

No response

What steps can reproduce the bug?

import path from 'path'

const test = 'foo.ts'

const out = changeExtension(test, '.rs')

console.log(out)

function changeExtension(p, ext) {
  const parsedPath = path.parse(p)
  const out = path.format({...parsedPath, base: '', ext})
  return out
}

What is the expected behavior?

$ node .
foo.rs

What do you see instead?

$ bun .

Additional information

base: null works however.

@vjpr vjpr added the bug Something isn't working label Aug 5, 2023
@robobun robobun added the node.js Compatibility with Node.js APIs label Aug 6, 2023
@Hanaasagi
Copy link
Collaborator

It looks like here we should check if base is an empty string.

if (path_object.getTruthy(globalThis, "base")) |prop| {

Hanaasagi added a commit to Hanaasagi/bun that referenced this issue Aug 8, 2023
Hanaasagi added a commit to Hanaasagi/bun that referenced this issue Aug 8, 2023
2) Avoid duplicating '/' at the beginning of the path.
Close: oven-sh#4005
Hanaasagi added a commit to Hanaasagi/bun that referenced this issue Aug 8, 2023
2) Avoid duplicating '/' at the beginning of the path.
Close: oven-sh#4005
Hanaasagi added a commit to Hanaasagi/bun that referenced this issue Aug 8, 2023
2. Avoid duplicating '/' at the beginning of the path.
Close: oven-sh#4005
Jarred-Sumner pushed a commit that referenced this issue Aug 8, 2023
2. Avoid duplicating '/' at the beginning of the path.
Close: #4005
trnxdev pushed a commit to trnxdev/bun that referenced this issue Aug 9, 2023
…h#4064)

2. Avoid duplicating '/' at the beginning of the path.
Close: oven-sh#4005
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node.js Compatibility with Node.js APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants