GaussianSplats3D icon indicating copy to clipboard operation
GaussianSplats3D copied to clipboard

Fail to determine file type if url has extra params

Open Jacky56 opened this issue 8 months ago • 1 comments

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.

Jacky56 avatar Apr 26 '25 22:04 Jacky56

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

VladimirKobranov avatar Jul 16 '25 14:07 VladimirKobranov