In issue.inc v1.233, the test for allowed extensions for attached file seems to be incorrect: issue.inc/project_issue_validate_file apparently exits with a form_error if an extension is not allowed for each role of the user instead of failing it is is not allowed for any of them as it seems that it should.
A similar test for extension permission is performed in project_issue.module/project_issue_munge_filename v1.28, but with a different logic, which seems to be correct: permissions for each role of the user are accumulated to the whitelist before testing, instead of testing/rejecting on each role separately.
Since it looks like this test could/should be refactored so that only one code and logic is used, I'm not submitting a patch unless you greenlight my so doing, because this would probably add another function and possibly affect other parts of the module.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | project_issue_extension_whitelist.patch_5.txt | 7.39 KB | dww |
| #12 | project_issue_extension_whitelist.patch_4.txt | 7.4 KB | dww |
| #10 | project_issue_extension_whitelist.patch_3.txt | 7.35 KB | dww |
| #7 | project_issue_extension_whitelist.patch_2.txt | 3.84 KB | dww |
| #3 | project_issue_extension_whitelist.patch.txt | 3.84 KB | dww |
Comments
Comment #1
dwwYes, it'd be great to see this fixed before the 5.x-1.0 release (which will be out any day now, probably). Sorry I overlooked this issue earlier...
Comment #2
fgmCould you confirm
Comment #3
dwwThese settings are only for issue attachments, so that's where things should go (for now). Please review and test the attached patch, it works under my limited testing, but it'd be great to get more eyes on this.
Comment #4
dwwOh, and as per the version listed here, this patch is for HEAD. We can backport it once we're happy with the code.
Comment #5
fgmLooks good to me.
Just two minor things:
Comment #6
fgmForgot to add that PEAR, upon which Drupal rules are based, use the lowercase form too, just like Zend Framework.
Comment #7
dww- new patch fixes the spelling typo, thanks. ;)
- TRUE vs. true is a much bigger debate. so long as core continues to use TRUE (and the vast bulk of drupal code in contrib), I'm sticking with that for consistency, even if there's a negligible speed improvement to using true...
Comment #8
fgmAnother minor tweak might be useful, and that is adding the "odg" extension to the whitelist. As one of the OpenDocument variants, it fits right there with the three others, not to mention the fact that users submitting issues are probably more likely to submit a drawing (odg) than a presentation (odp).
I know this can be changed after the fact, of course, but I think it would be best to include it in the default list.
Comment #9
dwwUpon closer inspection, this is screwed up in a few ways. I'm re-rolling a new patch now. Stay tuned for details once it's ready...
Comment #10
dwwNew patch:
Comment #11
hunmonk commented_project_issue_rolesComment #12
dww- extra space in description removed
- constants used (those are great, makes the code much more readable -- i didn't realize they existed). ;)
- re: fieldsets -- it matches how core handles this at admin/settings/uploads -- if it's good enough for core, it's good enough for me. ;)
thanks,
-derek
Comment #13
hunmonk commentedi think i'd prefer to lose the $sort variable in
_project_issue_roles-- what are we usually sorting there, maybe 6 or so role names? i'd rather give up the tiny performance hit there in order to keep that code simple.Comment #14
hunmonk commented...or move the sorting to the settings page form builder...
Comment #15
dwwSure, there's only one place that needs it sorted, that form builder, so we can do the sort there. I was actually thinking of this as I was working on #10, but I decided it would be handy to just make it an arg. However, I'm fine with the simpler version for now, and if it turns out we need to use this more often and want it sorted more often, we can always change it in the future.
Comment #16
dwwForgot to mention, my latest patch also:
- adds a constant for the list of default extensions
- moves the defaults outside of a fieldset (to the top of the form) and changes the wording of the title and description
Comment #17
hunmonk commentedcode style is good. properly falls back to defaults if no roles contain allowed ext. properly sums exts across roles. properly disallows files not on the whitelist. properly displays all roles if auth role has create perm.
Comment #18
dwwCommitted to HEAD, DRUPAL-4-7--2 and DRUPAL-4-7. Thanks.
Comment #19
(not verified) commented