NPM Server doesn't understand %2F

NPM Server doesn't understand %2F

FrknFrkn Posts: 7Questions: 3Answers: 0
edited April 3 in Editor

I tried to cache the datatables.net packages that i use in my projects on my private npm registry so that pipelines can run faster using Verdaccio.

Pretty simple error, the npm.datatables.net registry only recognizes / and %2f, but not %2F

https://npm.datatables.net/@datatables.net/editor-bs5
works (status code 200)

https://npm.datatables.net/@datatables.net%2feditor-bs5
works (status code 200)

https://npm.datatables.net/@datatables.net%2Feditor-bs5
doesn't work (status code 403)
{
"error": "Not an Editor package that was requested. This registry holds only DataTables Editor packages."
}

--

The same 3 link variants work fine on another private npm registry (fontawesome), so i'm pretty sure its not a client problem.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    That's interesting - thanks for flagging this up. I'll need to look into how exactly the server shold react to this. %2F is it URL encoded, so does that mean it is escaped and it is looking for a name space of "@datatables.net/editor-bs5", rather than a name space of "@datatables.net" and a package of "editor-bs5"?

    I don't know what registry server font awesome use, but it could be the one I'm using handles this differently.

    I'll look into it and get back to you. In the meantime, are you able to use a / rather than %2F?

    Allan

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Oh - stoopid me - sorry. I just registered the bit about case sensitivity. I'll dig into the server's code and see what is going on.

    Allan

  • FrknFrkn Posts: 7Questions: 3Answers: 0

    Thanks for the fast answer!

    I wanted to try out Verdaccio as a private npm registry/proxy and i can't influence their behaviour on url encoding. So it's not usable for me at the moment. From my side, i'm sending Verdaccio "@datatables.net/editor-bs5" without any url encoding, seems like they url encode it internally.

    Which registry server do you use? If it's open source i can take a look at their source too.

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Verdaccio as well. Overall I've been happy with it, this is the first issue I've really encountered. I do have it behind an nginx proxy, so it is possible the issue is there. I'm back from travelling last week, so hopefully will be able to look into it properly this week.

    Allan

  • FrknFrkn Posts: 7Questions: 3Answers: 0

    I just tried accessing a package on my Verdaccio instance (Apache reverse proxy) with all 3 link variants without any problems, so your guess about the nginx proxy could be right.

    Example nginx reverse proxy config:
    https://github.com/verdaccio/verdaccio/blob/master/docker-examples/v6/reverse_proxy/nginx/root_path/conf/nginx/sites-enabled/verdaccio-conf

    Let me know if i can help somehow

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    edited April 9 Answer ✓

    Got it - it was in fact an error on my part. In the custom authentication plugin for Verdaccio I'd written, I hadn't accounted for the case in a / / %2f check. I've added that now and hopefully it should work smoothly for you now.

    Allan

  • FrknFrkn Posts: 7Questions: 3Answers: 0

    It works now, thanks for your efforts!

Sign In or Register to comment.