File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ export class CreatorScraper {
8
8
private person : CSFDCreator ;
9
9
10
10
public async creator ( creatorId : number ) : Promise < CSFDCreator > {
11
- const url = creatorUrl ( + creatorId ) ;
11
+ const id = Number ( creatorId ) ;
12
+ if ( isNaN ( id ) ) {
13
+ throw new Error ( 'node-csfd-api: creatorId must be a valid number' ) ;
14
+ }
15
+ const url = creatorUrl ( id ) ;
12
16
const response = await fetchPage ( url ) ;
13
17
14
18
const creatorHtml = parse ( response ) ;
Original file line number Diff line number Diff line change @@ -29,7 +29,11 @@ export class MovieScraper {
29
29
private film : CSFDMovie ;
30
30
31
31
public async movie ( movieId : number ) : Promise < CSFDMovie > {
32
- const url = movieUrl ( + movieId ) ;
32
+ const id = Number ( movieId ) ;
33
+ if ( isNaN ( id ) ) {
34
+ throw new Error ( 'node-csfd-api: movieId must be a valid number' ) ;
35
+ }
36
+ const url = movieUrl ( id ) ;
33
37
const response = await fetchPage ( url ) ;
34
38
35
39
const movieHtml = parse ( response ) ;
You can’t perform that action at this time.
0 commit comments