Skip to content

Commit 0a5c90c

Browse files
Copilotfengmk2
andauthored
chore(deps): update mime-types to v3 (#899)
Fixes CI failures in #865 by updating test assertions for mime-types v3 breaking change. ## Breaking Change in mime-types v3 Per [RFC 9239](https://datatracker.ietf.org/doc/html/rfc9239), JavaScript MIME type changed from `application/javascript` to `text/javascript`: ```javascript // mime-types v2 mime.lookup('index.js') // => 'application/javascript' // mime-types v3 mime.lookup('index.js') // => 'text/javascript' ``` ## Changes - **package.json**: Update `mime-types` to `^3.0.2` and `@types/mime-types` to `^3.0.1` - **test/port/controller/PackageVersionFileController/raw.test.ts**: Update content-type assertions - **test/port/controller/PackageVersionFileController/listFiles.test.ts**: Update contentType field assertions > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `https://api.github.com//advisories` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js` (http block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/cnpm/cnpmcore/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > fix #865, update mime-types to v3 </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com> Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
1 parent d3e4fae commit 0a5c90c

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"ioredis": "^5.8.2",
108108
"leoric": "^2.13.9",
109109
"lodash-es": "^4.17.21",
110-
"mime-types": "^2.1.35",
110+
"mime-types": "^3.0.2",
111111
"mysql2": "^3.15.3",
112112
"node-rsa": "^1.1.1",
113113
"npm-package-arg": "^13.0.2",
@@ -132,7 +132,7 @@
132132
"@elastic/elasticsearch-mock": "^2.1.0",
133133
"@simplewebauthn/typescript-types": "^7.4.0",
134134
"@types/lodash-es": "^4.17.12",
135-
"@types/mime-types": "^2.1.4",
135+
"@types/mime-types": "^3.0.1",
136136
"@types/mocha": "^10.0.10",
137137
"@types/mysql": "^2.15.27",
138138
"@types/node": "^22.19.1",

test/port/controller/PackageVersionFileController/listFiles.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ describe('test/port/controller/PackageVersionFileController/listFiles.test.ts',
365365
{
366366
path: '/id/AccountId.js',
367367
type: 'file',
368-
contentType: 'application/javascript',
368+
contentType: 'text/javascript',
369369
integrity:
370370
'sha512-kFa+SXSMGbCh2DiuSGmlCS8OCBSE4VRGlq/A2IyY3QxL794soFq4zO3F+UEx4ANUG33urAa4LG4IY2OiUc2Mng==',
371371
lastModified: '2024-05-18T16:00:18.307Z',
@@ -383,7 +383,7 @@ describe('test/port/controller/PackageVersionFileController/listFiles.test.ts',
383383
{
384384
path: '/id/Mode.js',
385385
type: 'file',
386-
contentType: 'application/javascript',
386+
contentType: 'text/javascript',
387387
integrity:
388388
'sha512-jfMuIff4LW/ZQ8el9iCww8c9gw+12UK7eZn+6TMDAlStfLhlu8u7jcCSWSEG1zBTty9DIHn4Nbp+dMDjRUnVWQ==',
389389
lastModified: '2024-05-18T16:00:18.307Z',
@@ -401,7 +401,7 @@ describe('test/port/controller/PackageVersionFileController/listFiles.test.ts',
401401
{
402402
path: '/id/UUID.js',
403403
type: 'file',
404-
contentType: 'application/javascript',
404+
contentType: 'text/javascript',
405405
integrity:
406406
'sha512-bo/JyxOZeRRjbN0OR8vNRz3cTY2GcJfRmRnp3QTGXE5iuKYjrpjYzj+vEXopZV1QYPdZaXUK671EoysPE59pQQ==',
407407
lastModified: '2024-05-18T16:00:18.307Z',
@@ -464,7 +464,7 @@ describe('test/port/controller/PackageVersionFileController/listFiles.test.ts',
464464
{
465465
path: '/id/legalPerson/be/CRN.js',
466466
type: 'file',
467-
contentType: 'application/javascript',
467+
contentType: 'text/javascript',
468468
integrity:
469469
'sha512-K7fRjnkAkNnSYbWZW4A+xcdYbI2J1fk49AxFVut2Kk6LXOZbLH6nU9CFeo0YixDLa1Hl5sjLiUQ7Mur2HQgvNw==',
470470
lastModified: '2024-05-18T16:00:18.307Z',

test/port/controller/PackageVersionFileController/raw.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ describe('test/port/controller/PackageVersionFileController/raw.test.ts', () =>
298298
// .get(`/${pkg.name}/1.0.0/files/resource/ToOneFromχ.js`);
299299
res = await app.httpRequest().get(`/${pkg.name}/1.0.0/files/resource/ToOneFrom%CF%87.js`);
300300
assert.equal(res.status, 200);
301-
assert.equal(res.headers['content-type'], 'application/javascript; charset=utf-8');
301+
assert.equal(res.headers['content-type'], 'text/javascript; charset=utf-8');
302302
// console.log(res.text);
303303
assert.match(res.text, /ToOneFromχ/);
304304
});
@@ -459,7 +459,7 @@ describe('test/port/controller/PackageVersionFileController/raw.test.ts', () =>
459459
assert.equal(res.status, 200);
460460
assert.equal(res.headers['cache-control'], 'public, max-age=31536000');
461461
assert.equal(res.headers.vary, 'Origin, Accept, Accept-Encoding');
462-
assert.equal(res.headers['content-type'], 'application/javascript; charset=utf-8');
462+
assert.equal(res.headers['content-type'], 'text/javascript; charset=utf-8');
463463
assert.equal(res.headers['transfer-encoding'], 'chunked');
464464

465465
res = await app.httpRequest().get(`/${pkg.name}/1.0.0/files/docs/_site/getting-started.html`);
@@ -504,7 +504,7 @@ describe('test/port/controller/PackageVersionFileController/raw.test.ts', () =>
504504
res = await app.httpRequest().get(`/${pkg.name}/1.0.0/files/tests/integration/test.http.js`);
505505
assert.equal(res.headers['cache-control'], 'public, max-age=31536000');
506506
assert.equal(res.headers.vary, 'Origin, Accept, Accept-Encoding');
507-
assert.equal(res.headers['content-type'], 'application/javascript; charset=utf-8');
507+
assert.equal(res.headers['content-type'], 'text/javascript; charset=utf-8');
508508
assert.ok(!res.headers['content-disposition']);
509509
assert.equal(res.headers['transfer-encoding'], 'chunked');
510510
assert.match(res.text, /describe\(/);
@@ -517,7 +517,7 @@ describe('test/port/controller/PackageVersionFileController/raw.test.ts', () =>
517517
assert.deepEqual(res.body, {
518518
path: '/tests/integration/test.http.js',
519519
type: 'file',
520-
contentType: 'application/javascript',
520+
contentType: 'text/javascript',
521521
integrity: 'sha512-yysF4V48yKDI9yWuROuPd9cn9dn3nFQaAGkGMe46l6htQ6ZsoX4SAw9+FkhmmPez2VjxW/lYhWy21R1oOOu8Fw==',
522522
lastModified: publishTime,
523523
size: 1917,

0 commit comments

Comments
 (0)