-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
owncloud sharing notification emails without shared resource #11808
Comments
@nickvergessen any idea? |
No idea here. But I guess we could throw an exception there, if |
I also have this bug. And even a fix. The broken links and log messages with "Undefined offset" happen, when sharing a file or directory to a group, not a personal user. Debian 7.7 + Apache 2.2.22 + php5.4.34-0+deb7u1 + mysql-server-5.5 + 7.0.2-1 (installed and updated from repository download.opensuse.org). A small patch on /var/www/owncloud/lib/private/share/share.php: @@ -320,10 +320,11 @@
FROM
`*PREFIX*share`
WHERE
- `item_source` = ? AND `item_type` = ? AND `share_with` in (?)'
+ `item_source` = ? AND `item_type` = ? AND `share_with` in (' .
+ implode(',', array_fill(0, count($groups), '?')) . ')'
);
- $result = \OC_DB::executeAudited($query, array($itemSource, $itemType, implode(',', $groups)));
+ $result = \OC_DB::executeAudited($query, array_merge(array($itemSource, $itemType), $groups));
while ($row = $result->fetchRow()) {
$shares[] = $row; Group list passwed to SQL as a string like "group1,group2,..." which should be substituted to the "in (?)" part of select statement. That seems to work when list is empty or contains only one element. But when there are 2 or more (recipient user is member of 2 or more groups), it fails silently. I think SQL searches for one group with name "group1,group2,..." and finds nothing. It happens in OC\Share\Share::getItemSharedWithUser(). The calling code in mailnotifications.php finds nothing where it expects an array with at least one element [0], so we get a log message. My version converts a sequence of groups into a sequence of SQL parameter of the same length. I should note that I tested it only with MySQL and I am not sure it will work in all environments. Nor am I sure it is a best solution. But hope it shows the idea at least. Works ok for my server. Checking for empty($items) won't fix the bug completely, it may just suppress log warning, but will still break functionality. Is far as I see, the general process is:
|
@popov-d That's great. Thanks for helping debugging this! May I ask you to create a Pull Request with your suggested changes? - We can then easier review it and if we agree that this is the right approach merge it right away. Thank you! |
Sorry, I am a sysadmin, not a developer. Unfortunately I am not used with git, just pulled from repositories to me several times. It will take some time for me to learn, not today anyway. |
@popov-d No problem. What needs to be done is:
If you need any help feel free to ask! - We're also always at #owncloud-dev on the Freenode IRC. (but it might take some time until someone answers ;-)) |
It seems I created something, #12030. Not sure I've done everything correctly, but my changes are there. Hope my commit won't break anything else. |
Thanks a lot. That's correct that way. - We just require your license statement on this PR and then we can review this :-) |
As I understand, you mean this: http://owncloud.org/contribute/agreement/ . Just sent a scanned image to [email protected] accordingly. |
Yes. Either that (preferred) or state that the contribution is MIT licensed. But this approach is preferred as this will also work for future contributions. |
I tried that patch (12030) but it failed. Is the issue still under investigation? |
Sorry for a delay, I was on vacation. But just before it my production machine received an update to 7.0.3-1 from a repository on download.opensuse.org (I use Debian). The fix was already there, although slightly changed. After update I re-tested by case, everyting worked ok. I think you would update your installation the same way instead of patching. Additionally, you will get other fixes. Code around my original patch has also changed, so applying it directly may create errors. |
issue has been solved meanwhile - #12030 (comment) |
#24800) * Fixed group share searching for members of multiple group. Issue #11808. * Fixed group share searching, continued. Avoid searching for empty group list in getItemSharedWithUser(). Broke tests in previous commit, #12030. * Simler check for group count. * Fix for #24783 , described there * Now it's #24272, 24783 was a duplicate. Previous change was also not very good. Now we don't create ZIP with a single file inside.
#24800) * Fixed group share searching for members of multiple group. Issue #11808. * Fixed group share searching, continued. Avoid searching for empty group list in getItemSharedWithUser(). Broke tests in previous commit, #12030. * Simler check for group count. * Fix for #24783 , described there * Now it's #24272, 24783 was a duplicate. Previous change was also not very good. Now we don't create ZIP with a single file inside.
Our team has experienced weird notification emails - email subject doesn't have shared resource name and link (named "View it!") is broken
Email:
Email subject: John Doe shared »« with you
Body:
Hey there,
just letting you know that John Doe shared with you.
View it!
Cheers!
Links:
https://serverURL/index.php/apps/files?dir=
and
https://serverURL/index.php/apps/files?dir=%2F&scrollto=
Such emails are not sent everyday but still on regular bases over month already. These emails started to appear after upgrade from 6 to 7.
Maybe related to issue #11757
ownCloud log (data/owncloud.log)
Server configuration
Debian 7.6 + nginx + php5-fpm (5.4.4-14) + MySQL + ownCloud 7.0.2-1
The text was updated successfully, but these errors were encountered: