Skip to content

Commit e0369ec

Browse files
juliusmarmingecodex
andcommitted
Reuse shared URL diagnostics
Co-authored-by: codex <[email protected]>
1 parent 8b17c80 commit e0369ec

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎apps/mobile/src/features/files/workspace-file-image-cache.ts‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { getUrlDiagnostics } from "@t3tools/shared/urlDiagnostics";
12
import * as Data from "effect/Data";
23
import * as Effect from "effect/Effect";
34
import * as Hash from "effect/Hash";
@@ -49,16 +50,11 @@ async function prefetchWithNativeImage(uri: string): Promise<boolean> {
4950
}
5051

5152
function describeWorkspaceImageUri(uri: string) {
52-
let uriProtocol: string | null = null;
53-
try {
54-
uriProtocol = new URL(uri).protocol || null;
55-
} catch {
56-
// Relative and malformed URIs still retain safe length/hash diagnostics.
57-
}
53+
const diagnostics = getUrlDiagnostics(uri);
5854
return {
5955
uriHash: Hash.hash(uri),
60-
uriLength: uri.length,
61-
uriProtocol,
56+
uriLength: diagnostics.inputLength,
57+
uriProtocol: diagnostics.protocol ?? null,
6258
};
6359
}
6460

0 commit comments

Comments
 (0)