Skip to content

Commit 043be84

Browse files
committed
Do not loop on ignored postamble data
Bugfix, if there was something in the postamble, the parser would loop forever.
1 parent 0f6bfb4 commit 043be84

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Sources/multer/MultiPartParser.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// MacroExpress / multer
44
//
55
// Created by Helge Heß
6-
// Copyright © 2021-2023 ZeeZide GmbH. All rights reserved.
6+
// Copyright © 2021-2025 ZeeZide GmbH. All rights reserved.
77
//
88

99
#if canImport(Foundation)
@@ -190,8 +190,11 @@ public final class MultiPartParser {
190190
}
191191

192192
case .postamble:
193-
let input = unstage(with: input)
194-
if !input.isEmpty { handler(.postambleData(input)) }
193+
let postamble = unstage(with: input)
194+
input = Buffer() // consume everything
195+
if !postamble.isEmpty {
196+
handler(.postambleData(postamble))
197+
}
195198
}
196199
}
197200
}

0 commit comments

Comments
 (0)