@@ -20,7 +20,7 @@ async function handler (req, res, next) {
2020 const ldp = req . app . locals . ldp
2121 const includeBody = req . method === 'GET'
2222 const negotiator = new Negotiator ( req )
23- const baseUri = ldp . resourceMapper . getBaseUrl ( req . hostname , req . path )
23+ const baseUri = ldp . resourceMapper . resolveUrl ( req . hostname , req . path )
2424 const path = res . locals . path || req . path
2525 const requestedType = negotiator . mediaType ( )
2626 let possibleRDFType = negotiator . mediaType ( RDFs )
@@ -31,7 +31,7 @@ async function handler (req, res, next) {
3131
3232 // Set live updates
3333 if ( ldp . live ) {
34- res . header ( 'Updates-Via' , ldp . resourceMapper . getBaseUrl ( req . hostname ) . replace ( / ^ h t t p / , 'ws' ) )
34+ res . header ( 'Updates-Via' , ldp . resourceMapper . resolveUrl ( req . hostname ) . replace ( / ^ h t t p / , 'ws' ) )
3535 }
3636
3737 debug ( req . originalUrl + ' on ' + req . hostname )
@@ -156,21 +156,21 @@ async function globHandler (req, res, next) {
156156
157157 debugGlob ( 'found matches ' + matches )
158158 Promise . all ( matches . map ( match => new Promise ( async ( resolve , reject ) => {
159- const baseUri = await ldp . resourceMapper . mapFileToUrl ( { path : match , hostname : req . hostname } )
159+ const urlData = await ldp . resourceMapper . mapFileToUrl ( { path : match , hostname : req . hostname } )
160160 fs . readFile ( match , { encoding : 'utf8' } , function ( err , fileData ) {
161161 if ( err ) {
162162 debugGlob ( 'error ' + err )
163163 return resolve ( )
164164 }
165- // Files should have the .ttl extension or be extensionless (also Turtle)
166- if ( baseUri . contentType !== 'text/turtle' ) {
165+ // Files should be Turtle
166+ if ( urlData . contentType !== 'text/turtle' ) {
167167 return resolve ( )
168168 }
169169 // The agent should have Read access to the file
170170 hasReadPermissions ( match , req , res , function ( allowed ) {
171171 if ( allowed ) {
172172 try {
173- $rdf . parse ( fileData , globGraph , baseUri . url , 'text/turtle' )
173+ $rdf . parse ( fileData , globGraph , urlData . url , 'text/turtle' )
174174 } catch ( parseErr ) {
175175 debugGlob ( `error parsing ${ match } : ${ parseErr } ` )
176176 }
0 commit comments