fix: internal server error when uploading AVIF (#937)

* fix: add avif feature to dependencies

the comment should also say decode, encode uses rav1e not dav1d

Signed-off-by: infi <infi@infi.sh>

* chore: upgrade to debian 13

Signed-off-by: infi <infi@infi.sh>

* fix: revert unrelated EOF newlines

Signed-off-by: infi <infi@infi.sh>

* ci: provide dav1d

also in nix

Signed-off-by: infi <infi@infi.sh>

* chore: move feature definition to autumn Cargo.toml

Signed-off-by: infi <infi@infi.sh>

* fix: avif feature also required in revolt-files

Signed-off-by: infi <infi@infi.sh>

---------

Signed-off-by: infi <infi@infi.sh>
This commit is contained in:
infi
2026-08-24 19:56:15 +02:00
committed by GitHub
parent 99b3ea140f
commit 8e2eacb1b0
17 changed files with 228 additions and 26 deletions

View File

@@ -26,6 +26,16 @@ jobs:
# run: |
# sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc
- name: Install dav1d
run: |
sudo apt-get update
sudo apt-get install --yes libdav1d-dev pkg-config
if ! pkg-config --atleast-version=1.3.0 dav1d; then
echo "The runner's dav1d is older than 1.3, will install build tools"
sudo apt-get install --yes meson ninja-build nasm
fi
- name: Setup Mise
uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
with:
@@ -33,7 +43,7 @@ jobs:
- run: mise build
- run: mise docker:start
- name: Reference Test
env:
TEST_DB: REFERENCE

View File

@@ -21,6 +21,7 @@ run = [{ task = "service:*" }]
[env]
BUILDER = "cargo"
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL = "auto" # enable building dav1d iff the system doesn't have a new enough version
DOCKER_NETWORK_NAME = "stoatchat_default"
DATABASE_PORT = "27017"
RABBIT_PORT = "5672"

183
Cargo.lock generated
View File

@@ -472,6 +472,19 @@ version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "av-data"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fca67ba5d317924c02180c576157afd54babe48a76ebc66ce6d34bb8ba08308e"
dependencies = [
"byte-slice-cast",
"bytes",
"num-derive",
"num-rational",
"num-traits",
]
[[package]]
name = "av-scenechange"
version = "0.14.1"
@@ -1234,6 +1247,15 @@ version = "2.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
[[package]]
name = "bitreader"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "886559b1e163d56c765bc3a985febb4eee8009f625244511d8ee3c432e08c066"
dependencies = [
"cfg-if",
]
[[package]]
name = "bitstream-io"
version = "4.10.0"
@@ -1360,6 +1382,12 @@ version = "3.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
[[package]]
name = "byte-slice-cast"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d"
[[package]]
name = "bytemuck"
version = "1.25.0"
@@ -1477,6 +1505,16 @@ dependencies = [
"uuid",
]
[[package]]
name = "cfg-expr"
version = "0.20.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb693542bcafa528e198be0ebd9d3632ca5b7c93dbe7237460e199910835997c"
dependencies = [
"smallvec",
"target-lexicon",
]
[[package]]
name = "cfg-if"
version = "1.0.4"
@@ -2122,6 +2160,28 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376"
[[package]]
name = "dav1d"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ee89cb860616069c67520dcd66cacdb900b57c799f634a0eb6d91f6e2a82b61"
dependencies = [
"av-data",
"bitflags 2.13.0",
"dav1d-sys",
"static_assertions",
]
[[package]]
name = "dav1d-sys"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c91aea6668645415331133ed6f8ddf0e7f40160cd97a12d59e68716a58704b"
dependencies = [
"libc",
"system-deps",
]
[[package]]
name = "deadqueue"
version = "0.2.5"
@@ -2676,6 +2736,15 @@ dependencies = [
"zune-inflate",
]
[[package]]
name = "fallible_collections"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a88c69768c0a15262df21899142bc6df9b9b823546d4b4b9a7bc2d6c448ec6fd"
dependencies = [
"hashbrown 0.13.2",
]
[[package]]
name = "fastrand"
version = "1.9.0"
@@ -3329,6 +3398,9 @@ name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash 0.8.12",
]
[[package]]
name = "hashbrown"
@@ -3952,10 +4024,12 @@ dependencies = [
"bytemuck",
"byteorder-lite",
"color_quant",
"dav1d",
"exr",
"gif 0.14.2",
"image-webp 0.2.4",
"moxcms",
"mp4parse",
"num-traits",
"png 0.18.1",
"qoi",
@@ -5182,6 +5256,20 @@ dependencies = [
"pxfm",
]
[[package]]
name = "mp4parse"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63a35203d3c6ce92d5251c77520acb2e57108c88728695aa883f70023624c570"
dependencies = [
"bitreader",
"byteorder",
"fallible_collections",
"log",
"num-traits",
"static_assertions",
]
[[package]]
name = "multer"
version = "3.1.0"
@@ -8643,6 +8731,15 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
dependencies = [
"serde_core",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@@ -8965,6 +9062,12 @@ dependencies = [
"loom",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strict-num"
version = "0.1.1"
@@ -9187,6 +9290,19 @@ dependencies = [
"libc",
]
[[package]]
name = "system-deps"
version = "7.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "396a35feb67335377e0251fcbc1092fc85c484bd4e3a7a54319399da127796e7"
dependencies = [
"cfg-expr",
"heck 0.5.0",
"pkg-config",
"toml 1.1.4+spec-1.1.0",
"version-compare",
]
[[package]]
name = "tagptr"
version = "0.2.0"
@@ -9205,6 +9321,12 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "target-lexicon"
version = "0.13.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
[[package]]
name = "tcp-stream"
version = "0.34.14"
@@ -9539,11 +9661,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"serde_spanned 0.6.9",
"toml_datetime 0.6.11",
"toml_edit 0.22.27",
]
[[package]]
name = "toml"
version = "1.1.4+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3aace63f4bbcdfc2c965b059de67119c89c4017a70d633be6c104910f67056f5"
dependencies = [
"indexmap 2.14.0",
"serde_core",
"serde_spanned 1.1.1",
"toml_datetime 1.1.1+spec-1.1.0",
"toml_parser",
"toml_writer",
"winnow 1.0.4",
]
[[package]]
name = "toml_datetime"
version = "0.6.11"
@@ -9553,6 +9690,15 @@ dependencies = [
"serde",
]
[[package]]
name = "toml_datetime"
version = "1.1.1+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
dependencies = [
"serde_core",
]
[[package]]
name = "toml_edit"
version = "0.19.15"
@@ -9560,7 +9706,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.14.0",
"toml_datetime",
"toml_datetime 0.6.11",
"winnow 0.5.40",
]
@@ -9572,18 +9718,33 @@ checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [
"indexmap 2.14.0",
"serde",
"serde_spanned",
"toml_datetime",
"serde_spanned 0.6.9",
"toml_datetime 0.6.11",
"toml_write",
"winnow 0.7.15",
]
[[package]]
name = "toml_parser"
version = "1.1.3+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
dependencies = [
"winnow 1.0.4",
]
[[package]]
name = "toml_write"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
[[package]]
name = "toml_writer"
version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
[[package]]
name = "totp-lite"
version = "2.0.1"
@@ -10173,6 +10334,12 @@ dependencies = [
"time",
]
[[package]]
name = "version-compare"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e"
[[package]]
name = "version_check"
version = "0.9.5"
@@ -10817,6 +10984,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "winnow"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
[[package]]
name = "winreg"
version = "0.50.0"

View File

@@ -133,7 +133,7 @@ jxl-oxide = "0.12.5"
sha2 = "0.10.8"
kamadak-exif = "0.5.4"
webp = "0.3.0"
image = "0.25.2" # avif encode requires dav1d system library: features = ["avif-native"]
image = "0.25.2"
thumbhash = "0.1.0"
lcms2 = "6.1.1" # for color profile processing

View File

@@ -1,5 +1,5 @@
# Build Stage
FROM --platform="${BUILDPLATFORM}" rust:1.92.0-slim-bookworm
FROM --platform="${BUILDPLATFORM}" rust:1.92.0-slim-trixie
USER 0:0
WORKDIR /home/rust/src
@@ -14,6 +14,7 @@ RUN apt-get update && \
apt-get install -y \
make \
pkg-config \
libdav1d-dev:"${TARGETARCH}" \
libssl-dev:"${TARGETARCH}"
COPY scripts/build-image-layer.sh /tmp/
RUN sh /tmp/build-image-layer.sh tools

View File

@@ -1,5 +1,5 @@
# Build Stage
FROM rust:1.92.0-slim-bookworm
FROM rust:1.92.0-slim-trixie
USER 0:0
WORKDIR /home/rust/src
@@ -11,6 +11,7 @@ RUN apt-get update && \
apt-get install -y \
make \
pkg-config \
libdav1d-dev \
libssl-dev
COPY scripts/build-image-layer.sh /tmp/

View File

@@ -1,9 +1,9 @@
# Build Stage
FROM ghcr.io/stoatchat/base:latest AS builder
FROM debian:12 AS debian
FROM debian:13 AS debian
# Bundle Stage
FROM gcr.io/distroless/cc-debian12:nonroot
FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=builder /home/rust/src/target/release/revolt-bonfire ./
COPY --from=debian /usr/bin/uname /usr/bin/uname

View File

@@ -34,7 +34,7 @@ revolt-result = { workspace = true }
# image processing
jxl-oxide = { workspace = true, features = ["image"] }
image = { workspace = true }
image = { workspace = true, features = ["avif-native"] } # AVIF decoding requires dav1d
# svg rendering
usvg = { workspace = true }

View File

@@ -1,9 +1,9 @@
# Build Stage
FROM ghcr.io/stoatchat/base:latest AS builder
FROM debian:12 AS debian
FROM debian:13 AS debian
# Bundle Stage
FROM gcr.io/distroless/cc-debian12:nonroot
FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=builder /home/rust/src/target/release/revolt-crond ./
COPY --from=debian /usr/bin/uname /usr/bin/uname

View File

@@ -1,9 +1,9 @@
# Build Stage
FROM ghcr.io/stoatchat/base:latest AS builder
FROM debian:12 AS debian
FROM debian:13 AS debian
# Bundle Stage
FROM gcr.io/distroless/cc-debian12:nonroot
FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=builder /home/rust/src/target/release/revolt-pushd ./
COPY --from=debian /usr/bin/uname /usr/bin/uname

View File

@@ -1,9 +1,9 @@
# Build Stage
FROM ghcr.io/stoatchat/base:latest AS builder
FROM debian:12 AS debian
FROM debian:13 AS debian
# Bundle Stage
FROM gcr.io/distroless/cc-debian12:nonroot
FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=builder /home/rust/src/target/release/revolt-voice-ingress ./
COPY --from=debian /usr/bin/uname /usr/bin/uname

View File

@@ -1,9 +1,9 @@
# Build Stage
FROM ghcr.io/stoatchat/base:latest AS builder
FROM debian:12 AS debian
FROM debian:13 AS debian
# Bundle Stage
FROM gcr.io/distroless/cc-debian12:nonroot
FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=builder /home/rust/src/target/release/revolt-delta ./
COPY --from=debian /usr/bin/uname /usr/bin/uname

View File

@@ -16,7 +16,7 @@ sha2 = { workspace = true }
jxl-oxide = { workspace = true }
kamadak-exif = { workspace = true }
# revolt_little_exif = "0.5.1"
image = { workspace = true }
image = { workspace = true, features = ["avif-native"] } # note: avif decoding requires dav1d on the system
thumbhash = { workspace = true }
lcms2 = { workspace = true }

View File

@@ -1,10 +1,17 @@
# Build Stage
FROM ghcr.io/stoatchat/base:latest AS builder
FROM debian:12 AS debian
FROM debian:13 AS debian
RUN apt-get update && \
apt-get install -y --no-install-recommends libdav1d7 && \
mkdir -p /runtime-libs && \
for library in /usr/lib/*-linux-gnu/libdav1d.so.7*; do \
cp -a --parents "$library" /runtime-libs; \
done
# Bundle Stage
FROM gcr.io/distroless/cc-debian12:nonroot
FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=builder /home/rust/src/target/release/revolt-autumn ./
COPY --from=debian /runtime-libs/ /
COPY --from=mwader/static-ffmpeg:7.1.1 /ffmpeg /usr/local/bin/
COPY --from=mwader/static-ffmpeg:7.1.1 /ffprobe /usr/local/bin/
COPY --from=debian /usr/bin/uname /usr/bin/uname

View File

@@ -2,7 +2,7 @@
FROM ghcr.io/stoatchat/base:latest AS builder
# Bundle Stage
FROM gcr.io/distroless/cc-debian12:nonroot
FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=builder /home/rust/src/target/release/revolt-gifbox ./
EXPOSE 14706

View File

@@ -1,10 +1,17 @@
# Build Stage
FROM ghcr.io/stoatchat/base:latest AS builder
FROM debian:12 AS debian
FROM debian:13 AS debian
RUN apt-get update && \
apt-get install -y --no-install-recommends libdav1d7 && \
mkdir -p /runtime-libs && \
for library in /usr/lib/*-linux-gnu/libdav1d.so.7*; do \
cp -a --parents "$library" /runtime-libs; \
done
# Bundle Stage
FROM gcr.io/distroless/cc-debian12:nonroot
FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=builder /home/rust/src/target/release/revolt-january ./
COPY --from=debian /runtime-libs/ /
COPY --from=mwader/static-ffmpeg:7.1.1 /ffmpeg /usr/local/bin/
COPY --from=mwader/static-ffmpeg:7.1.1 /ffprobe /usr/local/bin/
COPY --from=debian /usr/bin/uname /usr/bin/uname

View File

@@ -11,6 +11,7 @@ let
stdenv.cc.cc.lib
zlib
openssl.out
dav1d
];
pathsToLink = [ "/lib" ];
};
@@ -27,6 +28,7 @@ in pkgs.mkShell {
buildInputs = with pkgs; [
pkg-config
openssl.dev
dav1d
];
shellHook = ''