File tree 3 files changed +12
-3
lines changed
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
7
7
## [ Unreleased]
8
8
9
+ ## [ 2.1.2] - 2020-11-01
10
+
11
+ ### Fixed
12
+ - Fix fetch resources url incorrect
13
+
9
14
## [ 2.1.1] - 2020-10-30
10
15
11
16
### Fixed
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @wabarc/cairn" ,
3
- "version" : " 2.1.1 " ,
3
+ "version" : " 2.1.2 " ,
4
4
"description" : " Node package and CLI tool for saving web page as single HTML file" ,
5
5
"main" : " dist/cairn.js" ,
6
6
"types" : " dist/cairn.d.ts" ,
Original file line number Diff line number Diff line change 1
- import { createAbsoluteURL , http } from './utils' ;
1
+ import { createAbsoluteURL , isValidURL , http } from './utils' ;
2
2
import { css } from './css' ;
3
3
4
4
class URI {
@@ -9,6 +9,10 @@ class URI {
9
9
}
10
10
11
11
const assetURL = createAbsoluteURL ( url , baseURL ) ;
12
+ if ( ! isValidURL ( assetURL ) ) {
13
+ return content ;
14
+ }
15
+
12
16
const response = await http . fetch ( assetURL ) ;
13
17
if ( typeof response !== 'object' || ! Object . prototype . hasOwnProperty . call ( response , 'data' ) ) {
14
18
return content ;
@@ -17,7 +21,7 @@ class URI {
17
21
18
22
const contentType = response . headers [ 'content-type' ] || '' ;
19
23
if ( contentType === 'text/css' ) {
20
- content = await css . process ( Buffer . from ( content ) . toString ( ) , baseURL ) ;
24
+ content = await css . process ( Buffer . from ( content ) . toString ( ) , assetURL ) ;
21
25
}
22
26
23
27
return content ;
You can’t perform that action at this time.
0 commit comments