Community
Participate
Working Groups
extensionCommands.js validateSingleItem() This function is called for multiple times for each item in the navigator. When the item is a directory, we check it for content types (which loops over every available content type for each period in the filename) When no content types are returned, we assign application/octet stream as a content type (incorrect) We then see if the command applies to the application/octet stream content type Do the extension commands ever apply to a directory? If yes, we should be smarter about directory content types. If no, we can skip all the work and always return false for directories. Should a content type ever apply to a directory? If yes, it can only be a filename match and we should have a different content type comparison. If not, we should skip the included/excluded content types check.
(In reply to Curtis Windatt from comment #0) > Do the extension commands ever apply to a directory? Yes, according to the wiki page, commands have optional use of the content type. https://wiki.eclipse.org/Orion/Documentation/Developer_Guide/Plugging_into_Orion_pages#Validation_Properties > Should a content type ever apply to a directory? Only a file should have a content type and the wiki page seems to agree with this. Mark, any thoughts?
Created attachment 247212 [details] Fix My proposed fix adds two checks to short circuit the command validation. 1) If the command doesn't require or exclude any content types, don't bother looking up the content type, just return true - This would return true before, but would do an unecessary content type lookup 2) If the item is a directory, return false - The command includes/excludes a content type, but a directory can't have a content type, so the command isn't valid - Previously a content type would be looked up, or application/octet-stream assigned. So this change will affect the behaviour of a command using a content-type that matches. I think this is reasonable as having application commands be available on directories is incorrect.
(In reply to Curtis Windatt from comment #1) > Yes, according to the wiki page, commands have optional use of the content > type. Yep. > > Should a content type ever apply to a directory? > > Only a file should have a content type and the wiki page seems to agree with > this. Also correct.
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=cc4396138cecd50f731b87940f06cbd333a6dc73 Applied the fix to master I've had no issues with content types after running with this change for a few days. However, Orion bundle contributors could be exercising this code in different ways.