From 65eb91da879243b4a890e459f94273b0e5fa61af Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 17 Mar 2024 15:38:38 +0100 Subject: [PATCH] code layout --- ...ltiPartFieldWithoutLengthWithBoundary.writeOn..st | 12 +++++------- .../instance/partsDecodeWith.decodeFilesWith..st | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFieldWithoutLengthWithBoundary.writeOn..st b/repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFieldWithoutLengthWithBoundary.writeOn..st index 80eb6273a..6101da768 100644 --- a/repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFieldWithoutLengthWithBoundary.writeOn..st +++ b/repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/parseMultiPartFieldWithoutLengthWithBoundary.writeOn..st @@ -20,9 +20,7 @@ parseMultiPartFieldWithoutLengthWithBoundary: aBoundary writeOn: writer ifTrue: [ "Found a boundary. We're done" true ] ifFalse: [ | candidateIndex | - candidateIndex := boundaryCandidateIndex = 1 - ifTrue: [ 2 ] - ifFalse: [ boundaryCandidateIndex ]. + candidateIndex := boundaryCandidateIndex = 1 ifTrue: [ 2 ] ifFalse: [ boundaryCandidateIndex ]. "Write all the bytes that we know are not part of a boundary" 1 to: candidateIndex - 1 do: [ :index | writer nextPut: (buffer at: index) ]. "Move the rest of the buffer to the beginning of the buffer" @@ -34,16 +32,16 @@ parseMultiPartFieldWithoutLengthWithBoundary: aBoundary writeOn: writer into: rawBuffer startingAt: bufferSize - candidateIndex + 2. buffer initializeWithCollection: rawBuffer. - "If the candidate was really the first token of the boundary - then we now have loaded the full boundary into the buffer. + "If the candidate was really the first token of the boundary then we now have loaded the full boundary into the buffer. If not we have to check for the next boundary candidate as we might have loaded the next boundary partially." buffer = aBoundary ] ] ifNil: [ writer nextPutAll: buffer. stream atEnd - ifFalse: [ "#next:into: answers a copy of the buffer if not enough bytes could be read""Use rawBuffer here so we can use the primitive to replace the bytes in the - buffer directly" + ifFalse: [ + "#next:into: answers a copy of the buffer if not enough bytes could be read. + Use rawBuffer here so we can use the primitive to replace the bytes in the buffer directly" stream next: bufferSize into: rawBuffer. buffer moveStartTo: 1. false ] diff --git a/repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/partsDecodeWith.decodeFilesWith..st b/repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/partsDecodeWith.decodeFilesWith..st index bec19f0fd..fa10e0a17 100644 --- a/repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/partsDecodeWith.decodeFilesWith..st +++ b/repository/Seaside-Zinc-Core.package/ZnStreamingMultiPartFormDataEntity.class/instance/partsDecodeWith.decodeFilesWith..st @@ -23,8 +23,7 @@ partsDecodeWith: aDecoderBlock decodeFilesWith: aFileDecoderBlock part contentType notNil and: [ part contentType isBinary ] ]) ifFalse: [ - ((part contentDispositionValues includes: 'form-data') and: [ - part contentLength isNil ]) + ((part contentDispositionValues includes: 'form-data') and: [ part contentLength isNil ]) ifTrue: [ self parseMultiPartFieldWithoutLengthWithMimePart: part