Skip to content
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

Attached file path unsetting in database_attachments plugin #4823

Closed
rcubetrac opened this issue May 14, 2015 · 8 comments
Closed

Attached file path unsetting in database_attachments plugin #4823

rcubetrac opened this issue May 14, 2015 · 8 comments
Assignees
Milestone

Comments

@rcubetrac
Copy link

Reported by @alecpl on 14 May 2015 13:43 UTC as Trac ticket #1490393

Currently it is not possible to unset specified argument. There are plugins which already do this, but it does not work as expected, e.g. database_attachments.

I propose to change https://github.com/roundcube/roundcubemail/blob/master/program/lib/Roundcube/rcube_plugin_api.php#L441 line to $args = $ret;

Question is: can we do this for 1.1?

Migrated-From: http://trac.roundcube.net/ticket/1490393

@rcubetrac
Copy link
Author

Comment by @alecpl on 19 May 2015 06:39 UTC

BTW, enabling database_attachments plugin in current situation breaks attachment thumbnails handling (in html editor) and attachments handling in Kolab plugins e.g. calendar. It's because in some places we check for 'path' argument first, which points to file that does not exist, of course.

@rcubetrac
Copy link
Author

Comment by @thomascube on 19 May 2015 06:58 UTC

According to the spec, plugins can also return partial hash arrays:

[...] The argument var may be altered by the callback function and can (even partially) be returned to the application.

That's why we have this $ret + $args. I admit that the spec doesn't account for the possibility to unset argument. But is it really necessary for plugins to unset values?

@rcubetrac
Copy link
Author

Comment by @thomascube on 19 May 2015 07:00 UTC

Replying to alec:

It's because in some places we check for 'path' argument first, which points to file that does not exist, of course.

Would $ret['path'] = null work instead of unsetting it?

@rcubetrac
Copy link
Author

Comment by @alecpl on 19 May 2015 07:11 UTC

Setting to null works. I missed the specification part. So, probably better to not touch it and fix the plugin instead?

@rcubetrac
Copy link
Author

Owner changed by @alecpl on 19 May 2015 07:17 UTC

thomasb => alec

@rcubetrac
Copy link
Author

Comment by @alecpl on 19 May 2015 07:27 UTC

Fixed in b3bf9c8.

@rcubetrac
Copy link
Author

Status changed by @alecpl on 19 May 2015 07:27 UTC

new => closed

@rcubetrac
Copy link
Author

Summary changed by @alecpl on 19 May 2015 07:27 UTC

Plugins can't unset hook arguments

Attached file path unsetting in database_attachments plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants