Skip to content

fix(viewer): resolve DuckDB extension repository URL safely with query strings - #303

Open
utkarshpatwa393-sys wants to merge 1 commit into
apple:mainfrom
utkarshpatwa393-sys:fix/duckdb-extension-repo-url
Open

utkarshpatwa393-sys wants to merge 1 commit into
apple:mainfrom
utkarshpatwa393-sys:fix/duckdb-extension-repo-url

Conversation

@utkarshpatwa393-sys

Copy link
Copy Markdown
Contributor

Summary

  • Replace manual regex truncation in extensionRepositoryUrl() (packages/viewer/src/utils/duckdb.ts) with new URL("duckdb-wasm", pageUrl).toString().
  • Previously, extensionRepositoryUrl() only stripped hash fragments (#...) before running replace(/\/[^/]*$/, "/"), which corrupted the extension repository URL whenever query parameters contained / (e.g., ?dataset=org/name) or when the page URL was a bare origin without a trailing slash.
  • Export extensionRepositoryUrl(pageUrl = window.location.href) and add unit tests in packages/viewer/test/duckdb_url.test.ts.

Verification

  • npx prettier -c packages/viewer/src/utils/duckdb.ts packages/viewer/test/duckdb_url.test.ts: passed
  • npm --workspace packages/viewer test: 12 test files passed, 148/148 tests passed

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant