The discussion revolves around an issue with links to CSVs in automation data explorer PMs returning 404s. T_Disco reported the issue, stating that despite having the correct settings, the links to CSV files were not working for moderators and admins. pmusaraj requested the raw contents of the PM to investigate further.
T_Disco discovered that the issue was due to the CSV extension not being added to the authorized extensions for staff setting. After adding the extension, the CSV link in the PM worked. T_Disco suggested improvements to the automation pages and error handling to prevent similar issues.
In the data explorer ‘Allow groups to access this query’ is set to: moderators, admins, staff
In the Automation record ‘Attach the CSV file to the PM’ is ticked. The script is ‘Schedule a PM with Data explorer results’.
The recipients are an admin and a moderator - same result for both.
I’ve tried it with a couple of data explorer queries, ‘Inactive Users with no posts’ for instance. (The csv is available to download on the Data explorer page.)
The Discourse version installed is 3.4.0.beta3-dev (d7503a6153), the Data Explorer plugin is up to date (f2891947).
Automation setting for the ‘Inactive Users with no posts’ PM:
After adding the csv extension and retriggering a PM the csv link in the subsequent PM worked.
A couple of suggestions:
On the automation pages, add some text and a link after the tickbox ‘Attach the CSV file to the PM’. Something like: (Requires authorization of csv extension). Linking ‘authorization of csv extension’ to /admin/site_settings/category/all_results?filter=authorized%20extensions%20for%20staff
To help diagnose what the issue is in future instances, if possible, change the link in the PM when csv isn’t an authorized extension, from:
href=“/404”
to something like:
href=“/unauthorized”
I can’t do all your recommendations but from now when you save an automation using this script and attach_csv is checked, it will generate an error if csv is not in the list of authorized_extensions: