Skip to content

Commit

Permalink
Fix loading session shares that have a plus sign in the sessionId (#3524
Browse files Browse the repository at this point in the history
)

* Encode the URI component

* Fix for older versions by updating lambda code directly
  • Loading branch information
cmdcolin committed Feb 16, 2023
1 parent 819526f commit b645ef1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ async function readSession(sessionId) {

exports.handler = async event => {
const data = event.queryStringParameters
const { sessionId } = data
let { sessionId } = data
let tableData

// workaround for '+' character being encoded by api gateway (?) as space, xref
// https://github.com/GMOD/jbrowse-components/pull/3524
sessionId = sessionId.replace(/ /g, '+')
try {
tableData = await readSession(sessionId)
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion products/jbrowse-web/src/sessionSharing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function readSessionFromDynamo(
signal?: AbortSignal,
) {
const sessionId = sessionQueryParam.split('share-')[1]
const url = `${baseUrl}?sessionId=${sessionId}`
const url = `${baseUrl}?sessionId=${encodeURIComponent(sessionId)}`
const response = await fetch(url, {
signal,
})
Expand Down

0 comments on commit b645ef1

Please sign in to comment.