Skip to content

Commit

Permalink
File path normalization towards ptarmiganlabs#521
Browse files Browse the repository at this point in the history
  • Loading branch information
mountaindude committed Aug 6, 2022
1 parent 079a4ff commit bb71a6a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/routes/disk_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ async function handlerFileCopy(request, reply) {
// 1. fromFile is in a valid source directory (or subdirectory thereof),
// 2. toFile is in a valid associated destination directory (or subdirectory thereof)

const fromFile = upath.normalize(request.body.fromFile);
const toFile = upath.normalize(request.body.toFile);
const fromFile = upath.normalizeSafe(request.body.fromFile);
const toFile = upath.normalizeSafe(request.body.toFile);

const fromDir = upath.dirname(fromFile);
const toDir = upath.dirname(toFile);
Expand Down Expand Up @@ -120,8 +120,8 @@ async function handlerFileMove(request, reply) {
// 1. fromFile is in a valid source directory (or subdirectory thereof),
// 2. toFile is in a valid associated destination directory (or subdirectory thereof)

const fromFile = upath.normalize(request.body.fromFile);
const toFile = upath.normalize(request.body.toFile);
const fromFile = upath.normalizeSafe(request.body.fromFile);
const toFile = upath.normalizeSafe(request.body.toFile);

const fromDir = upath.dirname(fromFile);
const toDir = upath.dirname(toFile);
Expand Down Expand Up @@ -176,7 +176,6 @@ async function handlerFileDelete(request, reply) {
// 1. file exists
// 2. file is in a valid directoryv (or subdirectory thereof),

// const deleteFile = path.normalize(request.body.deleteFile);
const deleteFile = upath.normalizeSafe(request.body.deleteFile);
const deleteDir = upath.dirname(deleteFile);

Expand Down

0 comments on commit bb71a6a

Please sign in to comment.