S3generic rescan doesn’t work if charset inside Content-Type header
-
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)
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.