silverstripe/sapphire — pull request #656 by unclecheese (2012-07-19 21:57:40+00:00)
Title: BUGFIX: Uploads not working on DataObjects in Webkit browsers.

This resolves the "not found" bug that was occurring when Webkit browsers attempt to upload a file to a DataObject (e.g. GridField, ModelAdmin). If the ID parameter was not found, Webkit would pass a string of "undefined" to the upload handler, while Firefox would pass an int 0.

Consequently, the url handler /admin/pages/EditForm/ was failing because LeftAndMain::currentPageID() was believing that ID was in the request, because "undefined" as a string is (bool) true. The page was not found because of course SiteTree #undefined doesn't exist. All subsequent URL rules failed, and the request returned 404.

When a (int) 0 was passed, LeftAndMain::currentPageID() would return false for "ID" being in the request because 0 is falsy.