cnpm / cnpmcore

Private NPM Registry for Enterprise
https://npmmirror.com
MIT License
622 stars 84 forks source link

fix: 501 code #615

Closed elrrrrrrr closed 11 months ago

elrrrrrrr commented 11 months ago

Adjust the error codes related to the 'unpublish' feature:

  • ⚠️ Unpublishing all versions is currently not implemented on the server side, return the 501 code.
  • 🚨 When the search functionality is disabled, return 501 instead of 451.

调整 unpublish 相关错误码

socket-security[bot] commented 11 months ago

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
typescript 5.3.2...5.2.2 None +0/-0 40.6 MB typescript-bot
fengmk2 commented 11 months ago

为啥要返回 501?500+ 的 status 都是服务端异常,不合理啊。

elrrrrrrr commented 11 months ago

为啥要返回 501?500+ 的 status 都是服务端异常,不合理啊。

image

在之前 audit 相关场景也是都是返回的 501。感觉配置没有开启的时候比较合适。

451 一般在法律政策相关的「非法」请求返回,感觉这个场景下似乎不太适合?cc @Beace

fengmk2 commented 11 months ago

好吧,既然 gpt 都开口了,+1

Beace commented 11 months ago

知识点+1

elrrrrrrr commented 11 months ago

好吧,既然 gpt 都开口了,+1

https://github.com/npm/make-fetch-happen/blob/main/lib/remote.js#L85

😂 npm 不同意 哈哈,超过 500 的 code 会触发 retry 逻辑,一直卡住

codecov[bot] commented 11 months ago

Codecov Report

Attention: 162 lines in your changes are missing coverage. Please review.

Comparison is base (6624a36) 97.45% compared to head (a140f0d) 96.83%. Report is 141 commits behind head on master.

Files Patch % Lines
config/config.default.ts 53.03% 31 Missing :warning:
.../port/controller/admin/PaddingVersionController.ts 48.83% 22 Missing :warning:
app/core/service/FixNoPaddingVersionService.ts 54.54% 15 Missing :warning:
app/core/service/PackageSearchService.ts 93.64% 15 Missing :warning:
app/port/schedule/SyncBinaryWorker.ts 21.42% 11 Missing :warning:
app/core/service/PackageSyncerService.ts 89.01% 10 Missing :warning:
app/repository/PackageVersionRepository.ts 87.95% 10 Missing :warning:
app/core/service/PackageVersionFileService.ts 91.48% 8 Missing :warning:
app/core/entity/PaddingSemVer.ts 88.00% 6 Missing :warning:
app/core/service/PackageVersionService.ts 94.91% 6 Missing :warning:
... and 11 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #615 +/- ## ========================================== - Coverage 97.45% 96.83% -0.62% ========================================== Files 168 180 +12 Lines 15691 17548 +1857 Branches 2018 2283 +265 ========================================== + Hits 15291 16993 +1702 - Misses 400 555 +155 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.