Skip to content

Commit b97bba3

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/c8-10.1.2
2 parents 445d0ac + 19a1151 commit b97bba3

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

.github/workflows/linter.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
name: Linter
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
jobs:
66
linter:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
10-
- name: Use Node.js 14.x
11-
uses: actions/setup-node@v2
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-node@v4
1211
with:
13-
node-version: '14.x'
12+
node-version: 'lts/*'
1413
- name: Install Dependencies
1514
run: npm install
1615
- name: Lint
1716
run: |
1817
npm run eslint
19-
env:
20-
CI: true

.github/workflows/tester.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name: Tester
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
jobs:
66
tester:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10-
os: [ubuntu-latest, windows-latest, macos-latest]
11-
node-version: ['14.x', '16.x', '18.x']
10+
os: [ ubuntu-latest, windows-latest, macos-latest ]
11+
node-version: [ '18','20','22' ]
1212
fail-fast: false
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
- name: Use Node.js ${{ matrix.node-version }}
16-
uses: actions/setup-node@v2
16+
uses: actions/setup-node@v4
1717
with:
1818
node-version: ${{ matrix.node-version }}
1919
- name: Install Dependencies
@@ -26,21 +26,19 @@ jobs:
2626
runs-on: ${{ matrix.os }}
2727
strategy:
2828
matrix:
29-
os: [ubuntu-latest]
30-
node-version: ['14.x']
29+
os: [ ubuntu-latest ]
30+
node-version: [ 'lts/*' ]
3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
3333
- name: Use Node.js ${{ matrix.node-version }}
34-
uses: actions/setup-node@v2
34+
uses: actions/setup-node@v4
3535
with:
3636
node-version: ${{ matrix.node-version }}
3737
- name: Install Dependencies
3838
run: npm install
3939
- name: Coverage
4040
run: npm run test-cov
41-
env:
42-
CI: true
4341
- name: Coveralls
44-
uses: coverallsapp/github-action@master
42+
uses: coverallsapp/github-action@v2
4543
with:
4644
github-token: ${{ secrets.github_token }}

lib/encode_url.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const encodeURL = (str: string) => {
88
// Exit if input is a data url
99
if (parsed.origin === 'null') return str;
1010

11-
parsed.search = encodeURI(unescape(parsed.search));
11+
parsed.search = new URLSearchParams(parsed.search).toString();
1212
parsed.pathname = encodeURI(decodeURI(parsed.pathname));
1313
// preserve IDN
1414
return format(parsed, { unicode: true });

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"prepublishOnly": "npm install && npm run clean && npm run build",
99
"build": "tsc -b",
1010
"clean": "tsc -b --clean",
11-
"preeslint": "npm run clean && npm run build",
1211
"eslint": "eslint lib test",
1312
"pretest": "npm run clean && npm run build",
1413
"test": "mocha --require ts-node/register",
@@ -65,6 +64,6 @@
6564
"strip-indent": "^3.0.0"
6665
},
6766
"engines": {
68-
"node": ">=14"
67+
"node": ">=18"
6968
}
7069
}

test/encode_url.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ describe('encodeURL', () => {
6363
encodeURL(content).should.eql('http://foo.com/bar?query=b%C3%A1z#f%C3%B3o');
6464
});
6565

66+
it('perserve escape in search', () => {
67+
// https://github.com/hexojs/hexo-util/issues/411
68+
const content = 'https://fóo.com/path?search1=2%2B2&search2=bár';
69+
encodeURL(content).should.eql(content.replace('bár', 'b%C3%A1r'));
70+
});
71+
6672
it('idn', () => {
6773
const content = 'http://bár.com/baz';
6874
encodeURL(content).should.eql('http://bár.com/baz');

0 commit comments

Comments
 (0)