aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Storage/Directory.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-05-06 19:56:47 +0000
committerMario <mario@mariovavti.com>2020-05-06 19:56:47 +0000
commitef94072cee64aa465a8fb1b7e11b45591589eba9 (patch)
tree6ec3600574263981b3224f14ac6d39fff0cdb9d5 /Zotlabs/Storage/Directory.php
parentff3ff2478dabc642def14193a01649a384f3a88a (diff)
parent2757822cd8d23de65b65c59874a6c032d73aba81 (diff)
downloadvolse-hubzilla-ef94072cee64aa465a8fb1b7e11b45591589eba9.tar.gz
volse-hubzilla-ef94072cee64aa465a8fb1b7e11b45591589eba9.tar.bz2
volse-hubzilla-ef94072cee64aa465a8fb1b7e11b45591589eba9.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Storage/Directory.php')
-rw-r--r--Zotlabs/Storage/Directory.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index 8cda75fd1..1231dfa25 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -281,8 +281,19 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
$xpath = attach_syspaths($this->auth->owner_id, $hash);
- // returns the number of bytes that were written to the file, or FALSE on failure
- $size = file_put_contents($f, $data);
+
+ if (is_resource($data)) {
+ $fp = fopen($f,'wb');
+ if ($fp) {
+ pipe_streams($data,$fp);
+ fclose($fp);
+ }
+ $size = filesize($f);
+ }
+ else {
+ $size = file_put_contents($f, $data);
+ }
+
// delete attach entry if file_put_contents() failed
if ($size === false) {
logger('file_put_contents() failed to ' . $f);
@@ -315,7 +326,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
$d = q("UPDATE attach SET filesize = '%s', os_path = '%s', display_path = '%s', is_photo = %d, edited = '%s' WHERE hash = '%s' AND uid = %d",
dbesc($size),
dbesc($xpath['os_path']),
- dbesc($xpath['display_path']),
+ dbesc($xpath['path']),
intval($is_photo),
dbesc($edited),
dbesc($hash),
@@ -364,7 +375,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
$p = photo_upload($c[0], \App::get_observer(), $args);
}
- \Zotlabs\Daemon\Master::Summon([ 'Thumbnail' , $this->folder_hash ]);
+ \Zotlabs\Daemon\Master::Summon([ 'Thumbnail' , $hash ]);
$sync = attach_export_data($c[0], $hash);