Skip to content

Commit f4bb5d4

Browse files
committed
Revert "Move logic for shortid to the server"
This reverts commit 6d0793a.
1 parent 6d0793a commit f4bb5d4

File tree

1 file changed

+9
-1
lines changed
  • packages/app/src/app/pages/Sandbox

1 file changed

+9
-1
lines changed

packages/app/src/app/pages/Sandbox/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,15 @@ class SandboxPage extends React.Component {
4545
}
4646

4747
fetchSandbox = () => {
48-
const id = this.props.match.params.id;
48+
let id = this.props.match.params.id;
49+
50+
// If the id is in the form of "slugified-title-shortid" we can take the last
51+
// shortid and get the data with that. This solves the problem with urls becoming
52+
// invalid after giving a sandbox a new title.
53+
const split = id.split('-');
54+
if (!id.startsWith('github') && split.length > 1) {
55+
id = split.pop();
56+
}
4957

5058
this.props.signals.editor.sandboxChanged({ id });
5159
};

0 commit comments

Comments
 (0)