gaussian-splats-3d: 'Viewer::downloadSplatSceneToSplatBuffer -> File format not supported: /api/splat/<id>' for a URL without .ply extension
Symptom: @mkkellogg/gaussian-splats-3d 0.4.7 loads a splat through your own endpoint, viewer.addSplatScene('/api/splat/1ErEvp9NR7U', {...}). The endpoint returns a valid binary PLY (curl shows ply / format binary_little_endian 1.0 / element vertex 4979481 ...), but the viewer throws Error: Viewer::downloadSplatSceneToSplatBuffer -> File format not supported: /api/splat/1ErEvp9NR7U. Content-Type and the file's magic bytes make no difference.
Cause: the library picks the parser from the URL's ending only. In the build it is:
const sceneFormatFromPath = (path) => {
if (path.endsWith('.ply')) return SceneFormat.Ply;
else if (path.endsWith('.splat')) return SceneFormat.Splat;
else if (path.endsWith('.ksplat')) return SceneFormat.KSplat;
else if (path.endsWith('.spz')) return SceneFormat.Spz;
return null;
};Note that endsWith runs on the full string, so a query string also breaks detection: a signed URL like .../splat.ply?t=... returns null too.
Fix, either: 1. Pass the format explicitly (the option is checked before the path):
import { Viewer, SceneFormat } from '@mkkellogg/gaussian-splats-3d';
await viewer.addSplatScene(url, { format: SceneFormat.Ply, progressiveLoad: true });2. Make the route end in the extension, e.g. app.get('/api/splat/:sid.ply', ...) and load /api/splat/${sid}.ply. This is what got the HackPrinceton aerial splats loading in the end.
The same check is used by the library's util/create-ksplat.js converter (it calls LoaderUtils.sceneFormatFromPath on the input filename), so name input files *.ply / *.splat there as well.