File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,19 @@ function addLinks (res, fileMetadata) {
4343
4444async function linksHandler ( req , res , next ) {
4545 const ldp = req . app . locals . ldp
46- const { path : filename } = await ldp . resourceMapper . mapUrlToFile ( req )
46+ let filename
47+ try {
48+ // Hack: createIfNotExists is set to true for PUT or PATCH requests
49+ // because the file does not exist yet at this point.
50+ // But it will be created afterwards.
51+ // This should be improved with the new server architecture.
52+ ( { path : filename } = await ldp . resourceMapper
53+ . mapUrlToFile ( { url : req , createIfNotExists : req . method === 'PUT' || req . method === 'PATCH' } ) )
54+ } catch ( e ) {
55+ // Silently ignore errors here
56+ // Later handlers will error as well, but they will be able to given a more concrete error message (like 400 or 404)
57+ return next ( )
58+ }
4759
4860 if ( path . extname ( filename ) === ldp . suffixMeta ) {
4961 debug . metadata ( 'Trying to access metadata file as regular file.' )
You can’t perform that action at this time.
0 commit comments