Skip to content

Commit

Permalink
filter out mac directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxcapades committed Oct 18, 2023
1 parent b0eccc5 commit b6c1d1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,15 @@ private fun Path.repackZip(into: Path, using: Path): Map<String, Long> {
.forEach { (entry, input) ->

// If the zip entry contains a slash, we reject it (we don't presently allow subdirectories)
if (entry.name.contains('/') || entry.isDirectory)
if (entry.name.contains('/') || entry.isDirectory) {
// If the archive contains that awful __MACOSX directory, skip it
// silently.
if (entry.name.startsWith("__MACOSX")) {
return@forEach
}

throw BadRequestException("uploaded zip file must not contain subdirectories")
}

val tmpFile = using.resolve(entry.name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private fun fetchDatasetList(datasetList: List<DatasetRecord>): List<DatasetList
)
}
.toList(),
fileSummaries[it.datasetID]!!
fileSummaries[it.datasetID] ?: DatasetFileSummary(0u, 0u)
))
}

Expand Down

0 comments on commit b6c1d1a

Please sign in to comment.