Skip to content

Commit

Permalink
Merge pull request #818 from OneZoom/issue-785-nulls-in-url
Browse files Browse the repository at this point in the history
navigation/state: deparse states missing a pinpoint #785
  • Loading branch information
lentinj committed Apr 23, 2024
2 parents 2ee6900 + 7981a8f commit c9f1d96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion OZprivate/rawJS/OZTreeModule/src/navigation/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ function parse_pathname(state, pathname) {

/// pathname should equal pinpoint
function deparse_pathname(state) {
return state.url_base + state.pinpoint;
// NB: In some cases, pinpoint may be null: https://github.com/OneZoom/OZtree/issues/785
return state.url_base + (state.pinpoint || '');
}

/**
Expand Down
3 changes: 3 additions & 0 deletions OZprivate/rawJS/OZTreeModule/tests/test_navigation_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,8 @@ test('deparse_state', function (t) {
test_url_match("http://onezoom.example.com/life/@=6794#x1402,y364,w1.4013");
test_url_match("http://onezoom.example.com/life/@Myzopoda_aurita?otthome=%40_ancestor%3D983483%3D3600795");

// URLs without a pinpoint pass through unscathed
test_url_match("http://onezoom.example.com/life/?tour=%2Fmoo%2Foink.html");

t.end();
});

0 comments on commit c9f1d96

Please sign in to comment.