Skip to content

Commit

Permalink
[Bug] upload jar file type check bug fixed (#2321)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfboys authored Feb 12, 2023
1 parent 2a4d219 commit 0c87c6d
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,11 @@ object FileUtils extends org.apache.commons.io.FileUtils {
if (input == null) {
throw new RuntimeException("The inputStream can not be null")
}
val headerHex = Utils.tryWithResource(input) { in =>
val b = new Array[Byte](8)
Utils.tryWithResource(input) { in =>
val b = new Array[Byte](4)
in.read(b, 0, b.length)
bytesToHexString(b)
}
val jarFileTypes: mutable.Seq[String] = mutable.Seq(
"504B03040A000000",
"504B03040A000008",
"504B030414000808"
)
jarFileTypes.contains(headerHex)
} == "504B0304"
}

def isJarFileType(file: File): Boolean = {
Expand Down

0 comments on commit 0c87c6d

Please sign in to comment.