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

fix: ignore non-file on tar entry filter #458

Merged
merged 5 commits into from
May 5, 2023
Merged

fix: ignore non-file on tar entry filter #458

merged 5 commits into from
May 5, 2023

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented May 5, 2023

ENOENT: no such file or directory, stat '/root/.cnpmcore/downloads/2023/05/06/unpkg_@iov_wallet-providers@1.0.0_0f152162-9cce-4a80-bacc-41271b7aac3f/package'

@@ -110,6 +110,7 @@ const WHITE_FILENAME_CONTENT_TYPES = {
export function mimeLookup(filepath: string) {
const filename = path.basename(filepath).toLowerCase();
if (filename.endsWith('.ts')) return PLAIN_TEXT;
if (filename.endsWith('.lock')) return PLAIN_TEXT;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Merging #458 (969f126) into master (90d5046) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

❗ Current head 969f126 differs from pull request most recent head e2687fc. Consider uploading reports for the commit e2687fc to get more accurate results

@@            Coverage Diff             @@
##           master     #458      +/-   ##
==========================================
- Coverage   97.56%   97.50%   -0.06%     
==========================================
  Files         166      166              
  Lines       15372    15377       +5     
  Branches     2002     2000       -2     
==========================================
- Hits        14997    14993       -4     
- Misses        375      384       +9     
Impacted Files Coverage Δ
app/common/FileUtil.ts 100.00% <100.00%> (ø)
app/core/service/PackageVersionFileService.ts 97.22% <100.00%> (+0.07%) ⬆️

... and 2 files with indirect coverage changes

@fengmk2
Copy link
Member Author

fengmk2 commented May 5, 2023

https://unpkg.com/browse/noa-live2dapi@1.0.8/model/kp31/kp31_/destroy/%E6%9B%BF%E6%8D%A2%E9%85%8D%E7%BD%AE/model.json

竟然还有中文路径。。。

  sql: "SELECT * FROM `package_version_files` WHERE `package_version_id` = '645537672967dbdbc623eb3c' AND `directory` = '/model/kp31/kp31_/destroy/替换配置' AND `name` = 'model.json' LIMIT 1"

2023-05-06 01:05:54,247 WARN 1104822 [-/127.0.0.1/12246f90-eb67-11ed-9638-3ba850b69082/10558.541ms GET /] [PackageVersionFileService.syncPackageVersionFiles:error] packageVersionId: 645537672967dbdbc623eb3c, 1182 paths, tmpdir: /root/.cnpmcore/downloads/2023/05/06/unpkg_noa-live2dapi@1.0.8_b3395061-e620-4d61-b552-feb882af124a, error: Error: ER_CANT_AGGREGATE_2COLLATIONS: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '='

@fengmk2 fengmk2 marked this pull request as draft May 5, 2023 17:44
@@ -105,7 +107,9 @@ export class PackageVersionFileService extends AbstractService {
if (file) return file;
const stat = await fs.stat(localFile);
const distIntegrity = await calculateIntegrity(localFile);
const dist = pkg.createPackageVersionFile(path, pkgVersion.version, {
// make sure dist.path store to ascii, e.g. '/resource/ToOneFromχ.js' => '/resource/ToOneFrom%CF%87.js'
const distPath = encodeURIComponent(path).replace(/%2F/g, '/');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要做一下判断,超出 ascii 编码范围的才需要进行 encodeURIComponent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fengmk2 fengmk2 marked this pull request as ready for review May 5, 2023 17:48
@fengmk2 fengmk2 merged commit 7e63e7f into master May 5, 2023
@fengmk2 fengmk2 deleted the ignore-non-file branch May 5, 2023 17:53
fengmk2 pushed a commit that referenced this pull request May 5, 2023
[skip ci]

## [3.19.2](v3.19.1...v3.19.2) (2023-05-05)

### Bug Fixes

* ignore non-file on tar entry filter ([#458](#458)) ([7e63e7f](7e63e7f))
@github-actions
Copy link

github-actions bot commented May 5, 2023

🎉 This PR is included in version 3.19.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant