-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix for #1 - Intercepts filenames on HtmlReporter to truncate if length > 255 #2
Conversation
…ritten is within 255 chars long. If not, will get the difference and remove the number of characters == difference from the baseName of the file
fileWriter.writeFile = function writeFile(file, callback) { | ||
if (file.length > 255) { | ||
var excess = file.length - 255; | ||
var baseName = path.basename(file, '.html') |
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.
I am not sure but does fileWriter write more than just html files?
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.
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.
But those normally don't hit the 255 chars length, but I can also use the path.extname()
.
Will do.
thx for the PR, comments left on the diff. |
Thanks for the comments. Do you see any more places where I can improve it? |
Also for a little bit more info: Before improvements:
After improvements:
I guess it's always good to know :) |
Looks great now much simpler :) thanks a ton @mAiNiNfEcTiOn 👏 |
My pleasure ;) |
Looks like #3 started happening due to this :) |
|
||
fileWriter.writeFile = function writeFile(file, callback) { | ||
var ext = path.extname(file); | ||
file = file.slice(0, 255 - ext.length) + ext; |
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.
this + ext should only happen if the length was > 255
see #3
What does this PR do:
Basically adds an 'interceptor' that verifies if the filepath being written is within 255 chars long. If not, will get the difference and remove the number of characters == difference from the baseName of the file.
Fixes #1
Where should the reviewer start:
master
and with this PR.