summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-09-02 13:31:01 +0100
committerNathaniel Catchpole2016-09-02 13:31:21 +0100
commitb01e462e089dbb328ea89efe0331e1295ae067c2 (patch)
tree83cad2b3165361f4edc58c03459fed8cd6cdfad1
parent8b401c2ab6ce2030a8213dc3346483da946782b3 (diff)
Issue #2794207 by alexpott: sys_get_temp_dir() can return a path with a trailing slash
(cherry picked from commit ed8ceb79676366e7ec69d16ec41e3ae15e412b0b) (cherry picked from commit 5fd082b6786e2bef3f22ea16a8938dfd5589a081)
-rw-r--r--core/includes/file.inc4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/includes/file.inc b/core/includes/file.inc
index 017a3d6..a58e6dc 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1220,7 +1220,9 @@ function file_directory_os_temp() {
foreach ($directories as $directory) {
if (is_dir($directory) && is_writable($directory)) {
- return $directory;
+ // Both sys_get_temp_dir() and ini_get('upload_tmp_dir') can return paths
+ // with a trailing directory separator.
+ return rtrim($directory, DIRECTORY_SEPARATOR);
}
}
return FALSE;