publishing npm packages with scope fails with 404 #8937

Closed
opened 2025-11-02 08:23:37 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @Mai-Lapyst on GitHub (May 10, 2022).

Description

When trying to push an npm package, that has an scope inside its package name (i.e. @test/myPackage), the request fails with an 404 because npm actually URI-encodes the slash:

npm notice Publishing to http://<gitea domain>/api/packages/mai/npm/
npm ERR! code E404
npm ERR! 404 Not Found - PUT http://<gitea domain>/api/packages/mai/npm/@jhp%2fcompiler
npm ERR! 404 
npm ERR! 404  '@jhp/compiler@0.1.0' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Relevant npm code: f985dbbd9a/node_modules/npm-package-arg/lib/npa.js (L134-L135)=

Relevant gitea code: https://github.com/go-gitea/gitea/blob/main/routers/api/packages/api.go#L194=

Notes on testing on try.gitea.io: the package registry is currently disabled for the complete site, so I couldn't test it there.

Gitea Version

1.17.0+dev-561-g443675d18

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

linux

How are you running Gitea?

Using docker; image: gitea/gitea:dev

Database

MySQL

Originally created by @Mai-Lapyst on GitHub (May 10, 2022). ### Description When trying to push an npm package, that has an scope inside its package name (i.e. `@test/myPackage`), the request fails with an 404 because npm actually URI-encodes the slash: ``` npm notice Publishing to http://<gitea domain>/api/packages/mai/npm/ npm ERR! code E404 npm ERR! 404 Not Found - PUT http://<gitea domain>/api/packages/mai/npm/@jhp%2fcompiler npm ERR! 404 npm ERR! 404 '@jhp/compiler@0.1.0' is not in this registry. npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. ``` Relevant npm code: https://github.com/npm/cli/blob/f985dbbd9ad3910c65e023f55beac9ec691c5e2c/node_modules/npm-package-arg/lib/npa.js#L134-L135= Relevant gitea code: https://github.com/go-gitea/gitea/blob/main/routers/api/packages/api.go#L194= Notes on testing on try.gitea.io: the package registry is currently disabled for the complete site, so I couldn't test it there. ### Gitea Version 1.17.0+dev-561-g443675d18 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System linux ### How are you running Gitea? Using docker; image: gitea/gitea:dev ### Database MySQL
GiteaMirror added the topic/packagestype/bug labels 2025-11-02 08:23:37 -06:00
Author
Owner

@KN4CK3R commented on GitHub (Jun 24, 2022):

Could you provide a sample package and the command(s) you are using?

Scoped packages are supported in general:
02eb4b143b/modules/packages/npm/creator.go (L167-L173)
The integration tests use a scoped package too:
02eb4b143b/integrations/api_packages_npm_test.go (L31)

@KN4CK3R commented on GitHub (Jun 24, 2022): Could you provide a sample package and the command(s) you are using? Scoped packages are supported in general: https://github.com/go-gitea/gitea/blob/02eb4b143b24f2091d82137aa3ee7d3469598499/modules/packages/npm/creator.go#L167-L173 The integration tests use a scoped package too: https://github.com/go-gitea/gitea/blob/02eb4b143b24f2091d82137aa3ee7d3469598499/integrations/api_packages_npm_test.go#L31
Author
Owner

@Mai-Lapyst commented on GitHub (Jun 25, 2022):

It's seems to now working correctly when trying try.gitea.io; seems that an dependency update or else has fixed this issue.

@Mai-Lapyst commented on GitHub (Jun 25, 2022): It's seems to now working correctly when trying try.gitea.io; seems that an dependency update or else has fixed this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8937