When sending a request like this:
{"module":"API","format":"rss","pageUrl":"\xxxxxxxxxxxx","idSite":"1","period":"day","date":"last7","token_auth":"XYZANONYMIZED","method":"Actions.getPageUrl","filter_limit":100}
the api method Actions.getPageUrl
currently might return a completely empty datatable, if the url can't be found. But the RSS renderer tries to use the period
metadata of the datatable, which does not exist, and fails.
Simply returning the first subtables metadata for the empty table response solves that issue.
fixes #16918
It's a bit clearer, but I'm still unsure as to whether the period we pick in the list of tables will be what is expected by callers. I also noticed that this code doesn't appear to be tested (there don't seem to be any tests that call getPageUrl/getOutlink/etc.). Do you think it would be a good idea to add an integration or system test to cover this behavior and maybe check the period that is returned? If it's there isn't one already, perhaps there could be a rss test for this as well?
@diosmosis I've just added some RSS tests
@sgiehl is there a test that requests a page URL that cannot be found (to trigger the bug this PR fixes)?
@diosmosis I've just added a test that should throw an exception on 4.x-dev