File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ const HashParserHOC = function (WrappedComponent) {
37
37
window . removeEventListener ( 'hashchange' , this . handleHashChange ) ;
38
38
}
39
39
handleHashChange ( ) {
40
- const hashMatch = window . location . hash . match ( / # ( . + ) / ) ;
41
- const hashProjectId = hashMatch === null ? defaultProjectId : hashMatch [ 1 ] ;
40
+ const hashMatch = window . location . hash . slice ( 1 ) ;
41
+ const hashProjectId = hashMatch === '' ? defaultProjectId : hashMatch ;
42
42
this . props . setProjectId ( hashProjectId . toString ( ) ) ;
43
43
}
44
44
render ( ) {
Original file line number Diff line number Diff line change @@ -66,8 +66,8 @@ const getLocalStorage = key => {
66
66
} ;
67
67
68
68
const readHashProjectId = ( ) => {
69
- const match = location . hash . match ( / # ( . + ) / ) ;
70
- return match === null ? null : match [ 1 ] ;
69
+ const match = location . hash . slice ( 1 ) ;
70
+ return match === '' ? null : match ;
71
71
} ;
72
72
73
73
class Router {
Original file line number Diff line number Diff line change @@ -15,10 +15,9 @@ import appTarget from './app-target';
15
15
const getProjectId = ( ) => {
16
16
// For compatibility reasons, we first look at the hash.
17
17
// eg. https://turbowarp.org/embed.html#1
18
- const hashMatch = location . hash . match ( / # ( .+ ) / ) ;
19
- console . log ( hashMatch ) ;
20
- if ( hashMatch !== null ) {
21
- return hashMatch [ 1 ] ;
18
+ const hashMatch = location . hash . slice ( 1 ) ;
19
+ if ( hashMatch !== '' ) {
20
+ return hashMatch ;
22
21
}
23
22
// Otherwise, we'll recreate what "wildcard" routing does.
24
23
// eg. https://turbowarp.org/1/embed
You can’t perform that action at this time.
0 commit comments