GaussianSplats3D
GaussianSplats3D copied to clipboard
Fail to determine file type if url has extra params
Currently, if you provide a URL with a extra parameters, sceneFormatFromPath would fail to gather what extension it could be.
for example, you could have a signed url such as:
https://storage.googleapis.com/a_bucket/blob.splat?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Signature=1ba94...d14221
and the method sceneFormatFromPath would produce null as a result, because the path was not curated correctly for URLs, collecting the pathname from the url would have a better chance of gathering the possible extension type.
workaround:
this.finalUrl = this.splatUrl + `&f=.${this.type}`;
But, actually file loader must be some of these:
const filename = "example_model.ksplat";
// --- Method 1: Using .includes() ---
const isIncludesMatch =
filename.includes(".splat") ||
filename.includes(".ply") ||
filename.includes(".ksplat");
console.log("Includes Match:", isIncludesMatch); // true or false
// --- Method 2: Using RegExp with .test() ---
const extensionRegex = /\.(splat|ply|ksplat)$/;
const isRegexMatch = extensionRegex.test(filename);
console.log("Regex Match:", isRegexMatch); // true or false
// --- Optional: Case-insensitive version ---
const caseInsensitiveRegex = /\.(splat|ply|ksplat)$/i;
const isCaseInsensitiveMatch = caseInsensitiveRegex.test(filename);
console.log("Case-insensitive Regex Match:", isCaseInsensitiveMatch); // true or false