Repository navigation
Download plugin: a few observations while aligning with upstream #6497
Replies: 2 comments 3 replies
|
A defect, a consistency note and a design question, @Jimmi08. Points 2 and 3 are confirmed and going into one fix, master plus a release/v2.3.x twin. Point 1 changes how a file request is authorised, so it is @Deltik's to rule on rather than mine to agree to. I traced all of it at 2.
|
|
1. requiring the SEF slug
|




Uh oh!
There was an error while loading. Please reload this page.
Hi,
while aligning our download plugin with upstream (checked against
aa368363), I noticed a few things. Sharing them as suggestions - please correct me if I misread something.1. Suggestion: require the SEF slug for file requests
Background. On one of our sites downloads are for registered users only. Someone created an account, then used a script to guess download IDs and fetched all files at once. Since then we require the SEF slug together with the ID, and users are used to it. Long time ago, I know that there is count limitation pref now.
Current state. The
getroute already builds URLs with the slug (download/get/{download_id}/{download_sef}), but the redirect drops it (request.php?id=$1), sorequest.phpserves the file by ID alone. Legacyrequest.php?123works the same way.Idea (maybe as an opt-in pref, to keep old links working):
request.php?id=$1&sef=$2request.php, serve the file only when the ID and the storeddownload_sefmatch (exact comparison in PHP, not in SQL)Things we ran into:
e_QUERY, thestrpos(e_QUERY, "mirror")check and the file-extension regex can match the slug (slugs may contain dots), so they need to be skipped when$_GET['id']is setparse_str(), so+in a slug arrives as a space{DOWNLOAD_LIST_NAME=request}buildsrequest.php?IDdirectly instead ofe107::url('download', 'get', ...)We have this marked as LITE modification for now. Nothing else was needed to change for now.
2.
e_rss.php- undefined$e107In
data(),$e107->base_pathis used forlink,category_linkandenc_url, but$e107is not defined in that scope. On PHP 8 this gives Attempt to read property "base_path" on null. The links still work, because they end up relative andrss.phpprefixesSITEURLBASE.e_PLUGIN_ABS.enc_urlis never printed, sincee_rss.phpsetsenc_typeto an empty string andrss.phprequires all three enclosure values.3.
download_shortcodes.php- author shortcodes (minor)The same field is read in two different ways:
With the core queries (
d.*) the key is always present, so this only warns when the shortcode gets a partial row (e.g. a custom menu or template).sc_download_view_authoremail_lan()andsc_download_view_authorwebsite_lan()(lines 1026, 1032) also have noempty()check.Just a consistency note.
All reactions