Skip to content

Commit 3ddfb22

Browse files
authored
fix(resolution): prevent duplicate org in trace ID resolution (#1289)
The `looksLikeSlug` function in `src/lib/hex-id-recovery.ts` was incorrectly returning `true` for full target paths (e.g., `org/project/id`) because it only checked for alphanumeric characters and dashes, not the presence of slashes. This caused `buildSlugHint` to prepend the organization slug to an input that already contained it, resulting in an invalid trace ID with a duplicated organization segment (e.g., `org/org/project/id`). This malformed ID then led to a `ResolutionError`. This fix adds an early return to `looksLikeSlug` if the input string contains a `/` character. This ensures that full paths are correctly identified as not being bare slugs, preventing the erroneous prepending of the organization slug and resolving the `ResolutionError`. Fixes [CLI-1EF](https://sentry.sentry.io/issues/7437391088/?seerDrawer=true) <sub>Comment `@sentry <feedback>` on this PR to have Autofix iterate on the changes.</sub> Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
1 parent bb7422a commit 3ddfb22

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/lib/hex-id-recovery.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ export function extractHexCandidate(input: string): HexCandidate | null {
325325
*/
326326
export function looksLikeSlug(input: string): boolean {
327327
const trimmed = input.trim();
328+
if (trimmed.includes("/")) {
329+
return false;
330+
}
328331
if (trimmed.length < 3 || !trimmed.includes("-")) {
329332
return false;
330333
}

0 commit comments

Comments
 (0)