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

Arg parsing fails if URL ends with ] #520

Open
MattIPv4 opened this issue Apr 10, 2024 · 14 comments
Open

Arg parsing fails if URL ends with ] #520

MattIPv4 opened this issue Apr 10, 2024 · 14 comments

Comments

@MattIPv4
Copy link
Contributor

autocannon http://localhost\?id=\[1\] results in the help message being shown (if you log argv, it seems that the URL [missing the closing ]] is buried in argv._[0]._[0]).

autocannon http://localhost\?id=\[1\]\&other works as expected though (and logging argv shows that the URL is at argv._[0] as the code expects.

@mcollina
Copy link
Owner

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@MattIPv4
Copy link
Contributor Author

I dig a very small bit of digging into this, and it looks to be a bug in subarg I think. I cannot find a repository on GitHub for that package, it doesn't appear to be maintained. As such, I imagine this'll be quite a big chunk of work to find a replacement package for arg parsing that behaves in the same way.

@GlenTiki
Copy link
Collaborator

GlenTiki commented Apr 17, 2024

Hey @MattIPv4, The author of that module has basically removed their social media presence, including their GitHub, but there’s people who have gotten access to origin control for some of his repos/modules, specifically minimist, a popular cli parsing library that subarg was built to be used with. I’ve reached out here, and got a reply they’ll try get access to that repo - https://twitter.com/ljharb/status/1780589808382800279

This’ll allow us to upstream that fix without needing to create a successor fork.

@MattIPv4
Copy link
Contributor Author

👀 That tweet link doesn't go anywhere, but sounds good. And to confirm, you meant getting access to subarg, not minimist?

@GlenTiki
Copy link
Collaborator

My bad, deleted a few chars at the end! 😅 Its fixed now, fyi.

And yes, we're looking for subarg access to fix there.

@ljharb
Copy link
Contributor

ljharb commented Apr 18, 2024

Give me a few days to a week (or two), and I’ll either have the original package name and repo, or I’ll make a fork.

@ljharb
Copy link
Contributor

ljharb commented Apr 29, 2024

Unfortunately Github/npm weren't wiling or able to help, so I'll have to recover the repo myself and make a fork. I'll comment here once that's done.

@mcollina
Copy link
Owner

Thanks

@ljharb
Copy link
Contributor

ljharb commented Apr 29, 2024

https://github.com/minimistjs/subarg is now recovered, and i published the 3 original versions as @minimistjs/subarg.

I did not make any changes on these 3 publishes besides the package name, so the repo URL will still be incorrect.

I intend to publish a v1.0.1 after updating CI and other things, which will have the correct URLs, but in the meantime, you can do a drop-in replacement of subarg to @minimistjs/subarg, and you'll get a Tidelift-lifted, actually maintained package.

@mcollina
Copy link
Owner

mcollina commented May 2, 2024

@MattIPv4 @GlenTiki a PR would be really nice to fix this.

@ljharb
Copy link
Contributor

ljharb commented May 2, 2024

#524 replaces the dep; i'd love a detailed issue and/or PR in subarg about the underlying problem for this issue :-)

@mcollina
Copy link
Owner

mcollina commented May 2, 2024

ping @GlenTiki @MattIPv4

@GlenTiki
Copy link
Collaborator

GlenTiki commented May 7, 2024

I plan on picking this up btw if @MattIPv4 doesnt get a chance. I’m on vacation atm so sorry for the late response.

@MattIPv4
Copy link
Contributor Author

MattIPv4 commented May 7, 2024

Go for it, I've been super busy w/ work et al. Sorry!

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

No branches or pull requests

4 participants