Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion blocks/edit/prose/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,11 @@ function handleAwarenessUpdates(wsProvider, daTitle, win, path) {
wsProvider.on('connection-close', async () => {
const resp = await checkDoc(path);
if (resp.status === 404) {
const split = window.location.hash.slice(2).split('/');
const { hash } = window.location;
// Guard: hash must start with '#/' — during an IMS redirect the hash is '#access_token=...'
// and slice(2) would remove '#a', writing 'ccess_token=...' into the URL as an org name.
if (!hash.startsWith('#/')) return;
const split = hash.slice(2).split('/');
split.pop();
// Navigate to the parent folder
window.location.replace(`/#/${split.join('/')}`);
Expand Down
6 changes: 4 additions & 2 deletions blocks/shared/pathDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ export default function getPathDetails(loc) {
// config, edit, sheet
const editor = getView(pathname);

// IMS will redirect and there's a small window where old_hash exists
if (!fullpath || fullpath.startsWith('old_hash') || fullpath.startsWith('access_token')) return null;
// IMS redirect fragments appear as '/ld_hash=', '/old_hash=', '/access_token=' in the path.
// fullpath always starts with '/' here, so strip it before the prefix check.
const pathContent = fullpath.slice(1);
if (!pathContent || pathContent.startsWith('old_hash') || pathContent.startsWith('access_token') || pathContent.startsWith('ld_hash')) return null;

// Split everything up so it can be later used for both DA & AEM
const pathParts = sanitizePathParts(fullpath);
Expand Down
Loading