-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid oss upload fail > [SignatureDoesNotMatchError]: The request signature we calculated does not match the signature you provided. Check your key and signing method.
- Loading branch information
Showing
5 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,6 +193,26 @@ describe('test/port/controller/PackageVersionFileController/listFiles.test.ts', | |
assert.equal(res.body.error, '[NOT_FOUND] [email protected]/files/foo not found'); | ||
}); | ||
|
||
it('should auto sync after version publish', async () => { | ||
const pkg = await TestUtil.getFullPackage({ | ||
name: '@cnpm/unittest-unpkg-demo', | ||
version: '1.0.0', | ||
versionObject: { | ||
description: 'work with utf8mb4 💩, 𝌆 utf8_unicode_ci, foo𝌆bar 🍻', | ||
}, | ||
}); | ||
await app.httpRequest() | ||
.put(`/${pkg.name}`) | ||
.set('authorization', publisher.authorization) | ||
.set('user-agent', publisher.ua) | ||
.send(pkg) | ||
.expect(201); | ||
await app.httpRequest() | ||
.get(`/${pkg.name}/1.0.0/files/package.json`) | ||
.expect(200) | ||
.expect('content-type', 'application/json; charset=utf-8'); | ||
}); | ||
|
||
it('should 451 when package block', async () => { | ||
const { pkg } = await TestUtil.createPackage({ isPrivate: false }); | ||
let res = await app.httpRequest() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { strict as assert } from 'node:assert'; | ||
import { setTimeout } from 'node:timers/promises'; | ||
import { app, mock } from 'egg-mock/bootstrap'; | ||
import { TestUtil } from 'test/TestUtil'; | ||
import { calculateIntegrity } from 'app/common/PackageUtil'; | ||
|
@@ -174,7 +173,6 @@ describe('test/port/controller/PackageVersionFileController/raw.test.ts', () => | |
.set('user-agent', publisher.ua) | ||
.send(pkg); | ||
assert.equal(res.status, 201); | ||
await setTimeout(1000); | ||
res = await app.httpRequest() | ||
.get(`/${pkg.name}/1.0.0/files/resource/`); | ||
assert.equal(res.status, 200); | ||
|
@@ -190,6 +188,39 @@ describe('test/port/controller/PackageVersionFileController/raw.test.ts', () => | |
assert.match(res.text, /ToOneFromχ/); | ||
}); | ||
|
||
it('should ignore "." hidden dir', async () => { | ||
// https://unpkg.com/browse/[email protected]/ | ||
const tarball = await TestUtil.readFixturesFile('unpkg.com/bovo-ui-0.0.4-36.tgz'); | ||
const { integrity } = await calculateIntegrity(tarball); | ||
const pkg = await TestUtil.getFullPackage({ | ||
name: '@cnpm/bovo-ui', | ||
version: '1.0.0', | ||
versionObject: { | ||
description: 'foo latest description', | ||
}, | ||
attachment: { | ||
data: tarball.toString('base64'), | ||
length: tarball.length, | ||
}, | ||
dist: { | ||
integrity, | ||
}, | ||
main: './lib/index.js', | ||
}); | ||
let res = await app.httpRequest() | ||
.put(`/${pkg.name}`) | ||
.set('authorization', publisher.authorization) | ||
.set('user-agent', publisher.ua) | ||
.send(pkg); | ||
assert.equal(res.status, 201); | ||
res = await app.httpRequest() | ||
.get(`/${pkg.name}/1.0.0/files/`); | ||
assert.equal(res.status, 200); | ||
// console.log(res.body); | ||
assert.equal(res.body.files.find(file => file.path === '/.'), undefined); | ||
assert(res.body.files.find(file => file.path === '/dist')); | ||
}); | ||
|
||
it('should handle big tgz file', async () => { | ||
const tarball = await TestUtil.readFixturesFile('unpkg.com/pouchdb-3.2.1.tgz'); | ||
const { integrity } = await calculateIntegrity(tarball); | ||
|
@@ -214,7 +245,6 @@ describe('test/port/controller/PackageVersionFileController/raw.test.ts', () => | |
.set('user-agent', publisher.ua) | ||
.send(pkg); | ||
assert.equal(res.status, 201); | ||
await setTimeout(5000); | ||
res = await app.httpRequest() | ||
.get(`/${pkg.name}/1.0.0/files/`); | ||
assert.equal(res.status, 200); | ||
|