lib: fix tests for 386 platforms
Tests in lib/structure_helpers_test.go pass on amd64 platforms but fail on 386 platforms. This can be reproduced with the following steps: 1. Create a Dockerfile in aerc's source folder: FROM i386/alpine:edge RUN apk update && apk upgrade RUN apk add --no-cache go make scdoc WORKDIR aerc COPY . . RUN make CMD make tests 2. Build the image: $ docker buildx build --platform=linux/386 -t test . 3. Run the image: $ docker run --rm --platform=linux/386 -it test The test in lib/structure_helpers_test.go will fail. If the same above steps are done with this patch applied, all tests pass. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
76b39311dc
commit
e92573c5d7
|
@ -58,7 +58,9 @@ func FindAllNonMultipart(bs *models.BodyStructure, path []int, pathlist [][]int)
|
||||||
cur := append(path, i+1)
|
cur := append(path, i+1)
|
||||||
mimetype := strings.ToLower(part.MIMEType)
|
mimetype := strings.ToLower(part.MIMEType)
|
||||||
if mimetype != "multipart" {
|
if mimetype != "multipart" {
|
||||||
pathlist = append(pathlist, cur)
|
tmp := make([]int, len(cur))
|
||||||
|
copy(tmp, cur)
|
||||||
|
pathlist = append(pathlist, tmp)
|
||||||
} else if mimetype == "multipart" {
|
} else if mimetype == "multipart" {
|
||||||
if sub := FindAllNonMultipart(part, cur, nil); len(sub) > 0 {
|
if sub := FindAllNonMultipart(part, cur, nil); len(sub) > 0 {
|
||||||
pathlist = append(pathlist, sub...)
|
pathlist = append(pathlist, sub...)
|
||||||
|
|
Loading…
Reference in New Issue