Skip to content

Commit 187fc5d

Browse files
antonisclaude
andcommitted
fix(ios): normalize ./ prefix when resolving relative SOURCEMAP_FILE
Strip leading ./ via parameter expansion before joining with the project root, so ./maps/main.jsbundle.map resolves to a clean absolute path instead of /project/root/./maps/main.jsbundle.map. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6c83813 commit 187fc5d

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/core/scripts/sentry-xcode.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RN_PROJECT_ROOT="${PROJECT_DIR}/.."
2020
# would resolve relative paths against `ios/` and fail to find the file.
2121
# See: https://github.com/getsentry/sentry-react-native/issues/3889
2222
if [[ "$SOURCEMAP_FILE" != /* ]]; then
23-
export SOURCEMAP_FILE="$(cd "$RN_PROJECT_ROOT" && pwd)/$SOURCEMAP_FILE"
23+
export SOURCEMAP_FILE="$(cd "$RN_PROJECT_ROOT" && pwd)/${SOURCEMAP_FILE#./}"
2424
fi
2525

2626
if [ -z "$SENTRY_CLI_EXECUTABLE" ]; then

packages/core/test/scripts/sentry-xcode-scripts.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,10 @@ describe('sentry-xcode.sh', () => {
509509
SOURCEMAP_FILE: './maps/main.jsbundle.map',
510510
});
511511

512-
// The script concatenates: "$(cd RN_PROJECT_ROOT && pwd)/./maps/main.jsbundle.map"
513-
// The ./ is preserved but the path is absolute and valid for sentry-cli.
512+
// The leading ./ is stripped via ${SOURCEMAP_FILE#./} before concatenation,
513+
// so the result is a clean absolute path without any ./ component.
514514
const projectRoot = path.dirname(tempDir);
515-
const expectedPath = `${projectRoot}/./maps/main.jsbundle.map`;
515+
const expectedPath = path.join(projectRoot, 'maps/main.jsbundle.map');
516516

517517
expect(result.exitCode).toBe(0);
518518
expect(result.stdout).toContain(`SOURCEMAP_FILE=${expectedPath}`);

0 commit comments

Comments
 (0)