Skip to content

Commit

Permalink
Merge pull request #1991 from Sefaria/bug/sc-28672/several-topic-page…
Browse files Browse the repository at this point in the history
…s-aren-t-loading

fix(Topic Pages): getBulkText bug that led it to generate long URLs
  • Loading branch information
nsantacruz authored Aug 1, 2024
2 parents 864ea28 + dfa7d47 commit a3c4b67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions static/js/sefaria/sefaria.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,16 +479,16 @@ Sefaria = extend(Sefaria, {
let refStrs = [""];
refs.map(ref => {
let last = refStrs[refStrs.length-1];
const encodedRef = encodeURIComponent(ref)
if (`${hostStr}${last}|${encodedRef}${paramStr}`.length > MAX_URL_LENGTH) {
refStrs.push(encodedRef)
const encodedFullURL = encodeURI(`${hostStr}${last}|${ref}${paramStr}`);
if (encodedFullURL.length > MAX_URL_LENGTH) {
refStrs.push(ref)
} else {
refStrs[refStrs.length-1] += last.length ? `|${encodedRef}` : encodedRef;
refStrs[refStrs.length-1] += last.length ? `|${ref}` : ref;
}
});

let promises = refStrs.map(refStr => this._cachedApiPromise({
url: `${hostStr}${refStr}${paramStr}`,
url: `${hostStr}${encodeURIComponent(refStr)}${paramStr}`,
key: refStr + paramStr,
store: this._bulkTexts
}));
Expand Down

0 comments on commit a3c4b67

Please sign in to comment.