-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Updater follows Location headers for valid archive filename #12817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… of the update archive
|
@milux In a moment I'll be testing this PR. |
|
I have tested this item ✅ successfully on 613a6c1 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12817. |
|
I have tested this item ✅ successfully on 613a6c1 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12817. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12817. |
|
Hmm i'm not sure here. @mbabker can you take a look here? |
|
Waiting for review This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12817. |
|
@zero-24 The change could be problematic when the last observed location does not represent a file ending on ".zip". Is that possible? In that case I might check for proper file extension and append it manually if necessary... |
|
Well there are two options:
I don't think there's an issue here honestly, unless someone's got a scenario I'm not aware of to look at. |
|
Thanks @mbabker 👍 |
There are actually two more options: So, what should it be? ;) |
|
Leave it as is. I wouldn't hardcode a .zip suffix check in the off chance the file extension ever changes (like if we tried serving the smaller |
administrator/components/com_joomlaupdate/restore.php it only supports: JPA, JPS, ZIP |
|
... with JPA and JPS being Akeeba-specific formats afaik, but how about a 5th solution: |
|
This is fine as is. Really we'd only have further problems if someone uploaded packages to AWS in the future without a file extension, in which case it'd probably be a broken file anyway. Plus our main interface to AWS is through the downloads site and is a Joomla extension, so the packages are going through validation on upload there. Let's roll with it. @joomla/cms-maintainers When this is merged, I'd suggest tagging a standalone update for the update component since it looks like anyone hosting a production site on a Windows platform will have issues upgrading with packages pulled from AWS thanks to the URL query strings in both the XML update file and the resulting URL after following all redirects. |
|
There is a rare problem (maybe not possible problem) that might occur with this PR if the redirect/final URL does not have a query string (no character ?) then: // Remove URL and query string
$urlBasename = basename($packageURL);
$basename = substr($urlBasename, 0, strpos($urlBasename, '?'));$basename will be empty, because substr will return an empty string, because strpos will give FALSE as length parameter This should be safer : // Remove URL and query string
$basename = basename($packageURL);
if (strpos($basename, '?'))
{
$basename = substr($basename , 0, strpos($basename, '?'));
} |
|
Please see my above comment about adding zip as extension
Also we can try to grab the extension for the original update URL too, Is it preferable if no extension is detected that upgrade will fail ? |
|
Needs tests again and it seems that Travis is not happy |
|
Exactly... I just wonder how I made it unhappy? 🤔 |
| $basename = basename($packageURL); | ||
| if (strpos($basename, '?') !== false) | ||
| { | ||
| $basename = substr($basename , 0, strpos($basename, '?')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line, remove the space between $basename and the comma.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't recognize this when copy-pasting the suggestion of @ggppdk
|
@jeckodevelopment Maybe now? 😉 |
|
test test test 😄 |
|
I have tested this item ✅ successfully on 4c66273 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12817. |
1 similar comment
|
I have tested this item ✅ successfully on 4c66273 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12817. |
|
@jeckodevelopment Done, for the sake of it. (There wasn't really a change, and yes, I actually tested it even though and didn't just press the submit test button. 😉 ) |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12817. |
…2817) * made download() follow Location headers to resolve the valid filename of the update archive * integrated suggestion of ggppdk, valid behavior if no query string * strict type checking * make Travis happy again... code style error
|
Is it planned a new version of the com_joomlaupdate component with this fix before the release of Joomla 3.7.0? |
|
No. We only distribute |
|
@wilsonge Without this fix |
|
I would suggest someone publish a page with guidance for users on a Windows platform as they cannot direct download and upgrade if the decision is to not release an interim update for the component. |
|
@mbabker This is a big global problem for all Windows users and Windows servers. Should I tell everyone in Poland that "One click update" does not work on Windows?. |
|
It's fixed in the code for 3.7. I can't do anything about any other decisions. |
|
How many people run Joomla on a windows server?
|
|
13% of sites sending stats in the last 60 days are Windows. How many of those are local dev versus production, we don't track, but that's definitely a higher use rate than other configurations we support. |
This comment was marked as abuse.
This comment was marked as abuse.
* made download() follow Location headers to resolve the valid filename of the update archive * integrated suggestion of ggppdk, valid behavior if no query string * strict type checking * make Travis happy again... code style error
Pull Request for Issue #12816
Summary of Changes
Changed method "download()" of class "JoomlaupdateModelDefault", found in administrator/components/com_joomlaupdate/models/default.php.
The method does now fetch the HTTP headers of the update download location
$updateInfo['object']->downloadurl->_datauntil the actual file (on AWS) is reached.It further removes the path and the query string from the URL, resulting in the actual filename of the update package, which should work fine for all platforms.
Testing Instructions
Some people should check whether I messed up something for some specific platform setup.
Documentation Changes Required
none