From e6a5c9f77406f3f53de158c2a65afdcb925d6896 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Wed, 23 Oct 2019 13:07:26 +0300 Subject: [PATCH] Do not encode path separator --- changelog/unreleased/36319 | 5 +++++ lib/private/LargeFileHelper.php | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/36319 diff --git a/changelog/unreleased/36319 b/changelog/unreleased/36319 new file mode 100644 index 000000000000..1238f4086c59 --- /dev/null +++ b/changelog/unreleased/36319 @@ -0,0 +1,5 @@ +Bugfix: LargeFileHelper::getFileSizeViaCurl is broken with newer libcurl + +getFileSizeViaCurl is a workaround for 32 bit platforms. Path separator was encoded when encoding the path but newer libcurl doesn't support that. + +https://github.com/owncloud/core/pull/36319 diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php index 3e4c0e042f13..c35c0db8ade7 100644 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -114,7 +114,9 @@ public function getFileSize($filename) { */ public function getFileSizeViaCurl($fileName) { if (\OC::$server->getIniWrapper()->getString('open_basedir') === '') { - $encodedFileName = \rawurlencode($fileName); + $pathParts = \explode('/', $fileName); + $encodedPathParts = \array_map('rawurlencode', $pathParts); + $encodedFileName = \implode('/', $encodedPathParts); $ch = \curl_init("file://$encodedFileName"); \curl_setopt($ch, CURLOPT_NOBODY, true); \curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);