Skip to content

Commit

Permalink
Merge pull request #37 from SwiftPackageIndex/update-maxByteSize
Browse files Browse the repository at this point in the history
Update max byte size
  • Loading branch information
finestructure committed Jan 26, 2024
2 parents f3bb6e1 + d77a9dd commit 7396dec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/SPIManifest/Manifest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public struct Manifest: Codable, Equatable {

extension Manifest {
public static let fileName = ".spi.yml"
public static let maxByteSize = 1_000
public static let maxByteSize = 1_500

public static func load(in directory: String = ".", maxByteSize: Int = Self.maxByteSize) -> Self? {
let path = directory.hasSuffix("/")
Expand All @@ -154,6 +154,11 @@ extension Manifest {
throw ManifestError.noData
}

return try load(data: data)
}

@discardableResult
public static func load(data: Data, maxByteSize: Int = maxByteSize) throws -> Self {
guard data.count <= maxByteSize else {
throw ManifestError.fileTooLarge(size: data.count)
}
Expand Down

0 comments on commit 7396dec

Please sign in to comment.