• Resolved vitkhab

    (@vitkhab)


    Hello. I’m using Updraft v1.16.46 and Yandex.Cloud S3-like object storage. Backup works great. But if I try to rescan remote storage Updraft doesn’t show any backups stored in object store.

    After debugging I’ve found that my S3 provider has “application/xml; charset=UTF-8” as a “Content-Type” header. Which is absolutely normal according to rfc. But Updraft doesn’t support that. Response isn’t processed. I’ve made a patch as workaround for this issue.

    diff --git a/wp-content/plugins/updraftplus/includes/S3.php b/wp-content/plugins/updraftplus/includes/S3.php
    index 30b6c23f..977d5081 100644
    --- a/wp-content/plugins/updraftplus/includes/S3.php
    +++ b/wp-content/plugins/updraftplus/includes/S3.php
    @@ -2313,7 +2313,7 @@ final class UpdraftPlus_S3Request {
     
                    // Parse body into XML
                    // The case in which there is not application/xml content-type header is to support a DreamObjects case seen, April 2018
    -               if (false === $this->response->error && isset($this->response->body) && ((isset($this->response->headers['type']) && 'application/xml' == $this->response->headers['type']) || (!isset($this->response->headers['type']) && 0 === strpos($this->response->body, '<?xml')))) {
    +               if (false === $this->response->error && isset($this->response->body) && ((isset($this->response->headers['type']) && FALSE !== strpos($this->response->headers['type'], 'application/xml')) || (!isset($this->response->headers['type']) && 0 === strpos($this->response->body, '<?xml')))) {
                            $this->response->body = simplexml_load_string($this->response->body);
     
                            // Grab S3 errors
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor DNutbourne

    (@dnutbourne)

    Hi,

    Thank you for the report and the patch.
    I will pass this on to our developers for further investigation.

    Best Wishes,
    Dee

    Thread Starter vitkhab

    (@vitkhab)

    Thank you

    Plugin Author David Anderson / Team Updraft

    (@davidanderson)

    @vitkhab

    I see – your patch removes the check for 'application/xml' == $this->response->headers['type']. Your description says that the value you’re seeing is application/xml; charset=UTF-8. In that case, presumably replacing 'application/xml' == $this->response->headers['type'] with false !== strpos($this->response->headers['type'], 'application/xml') should also work? Can you please try that?

    David

    Thread Starter vitkhab

    (@vitkhab)

    Hi, @davidanderson

    It’s hard to see due string length, but that’s exactly what I did in my patch. And it worked.

    Plugin Author David Anderson / Team Updraft

    (@davidanderson)

    Thank you. The change I proposed is now in our development version and will thus be in the next release. (So if you hand-tweak that on any affected sites you have, the change will be retained in future upgrades).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘S3generic rescan doesn’t work if charset inside Content-Type header’ is closed to new replies.