aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorgit-marijus <mario@mariovavti.com>2017-07-30 19:46:52 +0200
committergit-marijus <mario@mariovavti.com>2017-07-30 19:46:52 +0200
commit35c05a318016e3269e4bc677a36b515833fab66e (patch)
treeb4f494d1e8f24c0fc4d56913756df6f1fffc5ae9 /include
parent4a071b9a1cac32ed331a9a4e76d8a6c9aa312bef (diff)
downloadvolse-hubzilla-35c05a318016e3269e4bc677a36b515833fab66e.tar.gz
volse-hubzilla-35c05a318016e3269e4bc677a36b515833fab66e.tar.bz2
volse-hubzilla-35c05a318016e3269e4bc677a36b515833fab66e.zip
fix a bug where if multiple channels uploaded the same file to the same folder, the uploaded file would end up with an incremental number added to the filename for each upload even if the file did not exist yet in the channels folder
Diffstat (limited to 'include')
-rw-r--r--include/attach.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/attach.php b/include/attach.php
index 8de4983fa..785969a32 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -611,7 +611,8 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
// A freshly uploaded file. Check for duplicate and resolve with the channel's overwrite settings.
- $r = q("select filename, id, hash, filesize from attach where filename = '%s' and folder = '%s' ",
+ $r = q("select filename, id, hash, filesize from attach where uid = %d and filename = '%s' and folder = '%s' ",
+ intval($channel_id),
dbesc($filename),
dbesc($folder_hash)
);
@@ -633,7 +634,8 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$ext = $def_extension;
}
- $r = q("select filename from attach where ( filename = '%s' OR filename like '%s' ) and folder = '%s' ",
+ $r = q("select filename from attach where uid = %d and ( filename = '%s' OR filename like '%s' ) and folder = '%s' ",
+ intval($channel_id),
dbesc($basename . $ext),
dbesc($basename . '(%)' . $ext),
dbesc($folder_hash)