-
-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made tests cross platform #83
Conversation
var safeFileName = urlPath.replace(/\.\./g, '.'); | ||
safeFileName = path.normalize(safeFileName); | ||
return safeFileName; | ||
return urlPath.substring(1).replace(/\.\./g, '.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need substring
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use urlPath which is the absolute path on the website, e.g.: /some/path/something.html
. We want a relative path as a result, that is why we use .substring(1)
to cut off the starting /
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, got it, thanks
Thanks @marklagendijk
And need to add CI for windows. I'm going to do it in #84 |
I indeed only updated failing tests. Will take a look at the ones I missed. |
// if it replaces them we receive 'some/path/../../../../etc/passwd' | ||
// path.resolve('some/path/../../../../etc/passwd'); = '/etc/passwd' => which is not safe | ||
var r = new Resource('http://example.com/some/path/.../.../.../.../etc/passwd'); | ||
bySiteStructureFilenameGenerator(r, options).should.equalFileSystemPath('some/path/.../.../.../.../etc/passwd'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marklagendijk need to think how to handle this. Because not it replaces ...
=> ..
which makes code unsafe
we can:
- create directories with names
...
(as in test) - or cut that pieces
what do you think about this?
No description provided.