This repository was archived by the owner on Mar 29, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -3,18 +3,22 @@ export async function usePageOfSource(req, res) {
33 const sourceMap = res . locals . sourceMap ;
44 const path = "/" + req . params [ 0 ] ;
55
6- if ( sourceMap . has ( path ) ) {
6+ if ( sourceMap . has ( path ) ) {
77 const source = sourceMap . get ( path ) ;
88
99 const id = req . params . id ;
1010 const page = await source . getPage ( id ) ;
11+ if ( page == null ) {
12+ res . status ( 404 ) . send ( `The page with this ID does not exist` ) ;
13+ } else {
1114
12- const s = await page . getSerializedPage ( 'text/turtle' ) ;
13- s . pipe ( res ) ;
15+ const s = await page . getSerializedPage ( 'text/turtle' ) ;
16+ s . pipe ( res ) ;
17+ }
1418 }
1519 else {
1620 //console.error(`The endpoint ${path} does not exist`)
17- res . status ( 404 ) . send ( `The endpoint ${ path } does not exist` )
21+ res . status ( 404 ) . send ( `The endpoint ${ path } does not exist` ) ;
1822 }
19-
23+
2024}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export abstract class Source implements ISource {
2828 //rejectOnEmpty: true,
2929 } ) ;
3030 if ( response == null ) {
31- return new Page ( [ ] , [ ] ) ;
31+ return null ;
3232 }
3333 let parsed = JSON . parse ( response . page ) ;
3434 let page_ = this . deserializePage ( parsed ) ;
You can’t perform that action at this time.
0 commit comments