Skip to content

Commit c5c2e6e

Browse files
committed
Use ResourceMapper in copy handler
1 parent b6b3436 commit c5c2e6e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/handlers/copy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const url = require('url')
1414
* "Save an external resource to Solid" type apps.
1515
* @method handler
1616
*/
17-
function handler (req, res, next) {
17+
async function handler (req, res, next) {
1818
const copyFrom = req.header('Source')
1919
if (!copyFrom) {
2020
return next(error(400, 'Source header required'))
@@ -23,7 +23,7 @@ function handler (req, res, next) {
2323
const serverRoot = utils.getBaseUri(req)
2424
const copyFromUrl = fromExternal ? copyFrom : serverRoot + copyFrom
2525
const copyTo = res.locals.path || req.path
26-
const copyToPath = utils.reqToPath(req)
26+
const { path: copyToPath } = await req.app.locals.ldp.resourceMapper.mapUrlToFile({ url: req })
2727
ldpCopy(copyToPath, copyFromUrl, function (err) {
2828
if (err) {
2929
let statusCode = err.statusCode || 500

0 commit comments

Comments
 (0)