Skip to content

Commit 1f6c16f

Browse files
committed
fix: Do Not Overwrite req.url on Container PUT
`req.url` is not overwritten anymore when PUT is used to create a container. This allows subsequent middlewares to have access to the original request URL.
1 parent 33997ae commit 1f6c16f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/ldp.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,11 @@ class LDP {
243243
throw error(413, 'User has exceeded their storage quota')
244244
}
245245
// Set url using folder/.meta. This is Hack to find folder path
246-
if (container) {
247-
if (typeof url !== 'string') {
248-
url.url = url.url + suffixMeta
249-
} else {
250-
url = url + suffixMeta
251-
}
252-
contentType = 'text/turtle'
253-
}
254-
const { path } = await this.resourceMapper.mapUrlToFile({ url, contentType, createIfNotExists: true })
246+
const { path } = await this.resourceMapper.mapUrlToFile({
247+
url: container ? (url.url || url) + suffixMeta : url,
248+
contentType,
249+
createIfNotExists: true
250+
})
255251
// debug.handlers(container + ' item ' + (url.url || url) + ' ' + contentType + ' ' + path)
256252
// check if file exists, and in that case that it has the same extension
257253
if (!container) { await this.checkFileExtension(url, path) }

0 commit comments

Comments
 (0)