Skip to content

Commit

Permalink
Fixed handling of empty source map entries
Browse files Browse the repository at this point in the history
Source maps may contain empty map entries / empty file paths.

Fixes: failing gazelle tests (e.g., see and test `npm pack morphi`)
  • Loading branch information
max-leuthaeuser committed Nov 7, 2023
1 parent 0b22b2f commit e76204c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("io.shiftleft" % "sbt-ci-release-early" % "2.0.27")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
2 changes: 2 additions & 0 deletions src/main/scala/io/shiftleft/js2cpg/parser/JsSource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class JsSource(val srcDir: File, val projectDir: Path, val source: Source) {
}

private def constructSourceFilePath(sourceFileName: String): File = sourceFileName match {
case _ if sourceFileName.isEmpty =>
srcDir / source.getName
case _ if absoluteFilePath.contains(NuxtTranspiler.NUXT_FOLDER) && srcDir.path.compareTo(projectDir) == 0 =>
// For nuxt-js transpilation we have the same src and project dir and we need some special handling here
if (sourceFileName.startsWith(WEBPACK_PREFIX)) {
Expand Down

0 comments on commit e76204c

Please sign in to comment.