[albums] undefined node.parent #1793

Closed
opened 2026-10-05 00:56:51 +02:00 by adam · 0 comments
Owner

On several test environments, I can't manage my albums. I get this in the javascript console:

TypeError: undefined is not an object (evaluating 'node.parent')

It refers to this piece of code in albums.js :

    var url_split = window.location.href.split("cat_move");
    var catToOpen = url_split[url_split.length - 1].split("-")[1];
    console.log(catToOpen);
    if (catToOpen && isNumeric(catToOpen)) {
        nodeToGo = $('.tree').tree('getNodeById', catToOpen);
        goToNode(nodeToGo, nodeToGo);
        if (nodeToGo.children) {
            $(".tree").tree("openNode", nodeToGo, false);
        }
    }

The problem is that it tries to find an album id in the URL which is supposed to be like http://domain.tld/admin.php?page=albums&parent_id=2#cat-2 and it assumes there is only one legit "-" in this URL. Which is totally not sure. In my case, the domain name is something like server.ip-1-2-3-4.tld. Good luck with that.

The search for the album id should not rely on parsing the URL.

On several test environments, I can't manage my albums. I get this in the javascript console: ``` TypeError: undefined is not an object (evaluating 'node.parent') ``` It refers to this piece of code in `albums.js` : ``` var url_split = window.location.href.split("cat_move"); var catToOpen = url_split[url_split.length - 1].split("-")[1]; console.log(catToOpen); if (catToOpen && isNumeric(catToOpen)) { nodeToGo = $('.tree').tree('getNodeById', catToOpen); goToNode(nodeToGo, nodeToGo); if (nodeToGo.children) { $(".tree").tree("openNode", nodeToGo, false); } } ``` The problem is that it tries to find an album id in the URL which is supposed to be like `http://domain.tld/admin.php?page=albums&parent_id=2#cat-2` and it assumes there is only one legit "-" in this URL. Which is totally not sure. In my case, the domain name is something like `server.ip-1-2-3-4.tld`. Good luck with that. The search for the album id should not rely on parsing the URL. <!-- github-sync-id:2038268059 -->
adam closed this issue 2026-10-05 00:56:51 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1793