File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,14 @@ export const tokenFilterOut = (
123123} ;
124124
125125export const confluenceParentFromString = ( url : string ) : ConfluenceParent => {
126- const match = url . match (
126+ let toMatch = url ;
127+ const urlNoParamsList = url ?. split ( "?" ) ;
128+
129+ if ( urlNoParamsList . length === 2 ) {
130+ toMatch = urlNoParamsList [ 0 ] ?? url ;
131+ }
132+
133+ const match = toMatch . match (
127134 / ^ h t t p s .* ?w i k i \/ s p a c e s \/ (?: ( ~ ? \w + ) | ( ~ ? \w + ) \/ o v e r v i e w | ( ~ ? \w + ) \/ p a g e s \/ ( \d + ) .* ) $ /
128135 ) ;
129136 if ( match ) {
Original file line number Diff line number Diff line change @@ -310,6 +310,17 @@ const runConfluenceParentFromString = () => {
310310 assertEquals ( expected , result ) ;
311311 } ) ;
312312
313+ test ( "confluenceParentFromString_valid_spaces_pages_with_homepage" , async ( ) => {
314+ const url =
315+ "https://allenmanning.atlassian.net/wiki/spaces/~557058634d59d0949841909bb13093ab41d0c5/overview?homepageId=65617" ;
316+ const result = confluenceParentFromString ( url ) ;
317+ const expected : ConfluenceParent = {
318+ space : "~557058634d59d0949841909bb13093ab41d0c5" ,
319+ parent : undefined ,
320+ } ;
321+ assertEquals ( expected , result ) ;
322+ } ) ;
323+
313324 test ( "confluenceParentFromString_valid_noParent" , async ( ) => {
314325 const url = "https://test.atlassian.net/wiki/spaces/QUARTOCONF" ;
315326 const result = confluenceParentFromString ( url ) ;
You can’t perform that action at this time.
0 commit comments