You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The changeExtensionTo method (part of better.files.File) splits file names on the first occurrence of a dot and hence will incorrectly rename any file with multiple extensions, resulting in a java.io.FileNotFoundException when trying to read the file.
To Reproduce
Steps to reproduce the behavior:
importCode the attached example in joern example.zip
Observe the following error:
java.io.FileNotFoundException: /home/pr0me/Documents/code/phd/xample/script.ejs (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at scala.io.Source$.fromFile(Source.scala:94)
at scala.io.Source$.fromFile(Source.scala:79)
at io.shiftleft.utils.IOUtils$.readLinesInFile(IOUtils.scala:77)
at io.joern.jssrc2cpg.parser.BabelJsonParser$.readFile(BabelJsonParser.scala:35)
at io.joern.jssrc2cpg.passes.AstCreationPass.$anonfun$runOnPart$1(AstCreationPass.scala:48)
The original file name is script.js.ejs.
Expected behavior
File renaming should account for the possibility of multiple file extensions.
Desktop (please complete the following information):
OS: Linux pop-os 6.0.12-76060006-generic 22.04
Joern Version: 1.1.1646
javac 11.0.17
Additional context
I confirmed that the error is due to changeExtensionTo.
This
TEST 0: ./xx.js.md -> ./xx.js
TEST 1: ./xx.md.md -> ./xx.js
meaning that is also not only due to the extension and the replacement being the same.
From what I saw, changeExtensionTo is only used once in joern but I still was not sure what the best place to fix this would be.
The text was updated successfully, but these errors were encountered:
The
changeExtensionTo
method (part of better.files.File) splits file names on the first occurrence of a dot and hence will incorrectly rename any file with multiple extensions, resulting in ajava.io.FileNotFoundException
when trying to read the file.To Reproduce
Steps to reproduce the behavior:
importCode
the attached example in joernexample.zip
Observe the following error:
The original file name is
script.js.ejs
.Expected behavior
File renaming should account for the possibility of multiple file extensions.
Desktop (please complete the following information):
Additional context
I confirmed that the error is due to
changeExtensionTo
.This
will result in
meaning that is also not only due to the extension and the replacement being the same.
From what I saw,
changeExtensionTo
is only used once in joern but I still was not sure what the best place to fix this would be.The text was updated successfully, but these errors were encountered: