Fix an issue where file queries would throw incorrectly


Fix an issue where file queries would throw incorrectly

Ref T4589. When you look at a file, we load attached objects in order to run the "you can see this if you can see any attached object" policy check.

However, right now the subquery inherits the "throw on filter" flag from the parent query. This inheritance makes sense in other cases[1], but because this is an "ANY" rule it does not make sense here. In practice, it means that if the file is attached to several objects, and any of them gets filtered, you can not see the file.

Instead, explicitly drop the flag for this subquery.

[1] Sort of. It doesn't produce wrong results in other cases, but now that I think about it might produce a less-tailored error than it could. I'll look into this the next time I'm poking around.

Test Plan:

  • Viewed an "All Users" file attached to a private Mock.
  • Prior to this patch, I incorrectly received an exception when the Mock was loaded. This is wrong; I should be able to see the file because the policy is "All Users".
  • After the patch, I can correctly view the file, just not the associated mock.

Screen_Shot_2014-03-12_at_6.55.17_AM.png (554×1 px, 132 KB)

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: 20after4, aran, epriestley

Maniphest Tasks: T4589

Differential Revision: https://secure.phabricator.com/D8498


epriestleyAuthored on
epriestleyPushed on Aug 2 2014, 9:46 PM
Differential Revision
D8498: Fix an issue where file queries would throw incorrectly
rP9181929ebc2f: Give files uploaded to objects a very restrictive view policy

Event Timeline