Skip to content

Commit

Permalink
Fix loading directory specified by relative path (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsonlyjames authored Sep 17, 2024
1 parent 1da640a commit 633af66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function electronServe(options) {
const filePath = path.join(options.directory, decodeURIComponent(new URL(request.url).pathname));

const relativePath = path.relative(options.directory, filePath);
const isSafe = relativePath && !relativePath.startsWith('..') && !path.isAbsolute(relativePath);
const isSafe = !relativePath.startsWith('..') && !path.isAbsolute(relativePath);

if (!isSafe) {
callback({error: FILE_NOT_FOUND});
Expand Down

0 comments on commit 633af66

Please sign in to comment.