{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/26516195","id":26516195,"diff_hunk":"@@ -208,27 +206,46 @@ navigator.mozL10n.once(function showPanel() {\n         var getRequest = storage.get(filepath);\n \n         getRequest.onsuccess = function() {\n-          defaultAdapter.sendFile(targetDevice.address, getRequest.result);\n-          var msg = 'getFile succeed & file is sending...';\n-          debug(msg);\n-          if (--numberOfTasks === 0) {\n-            transferred();\n-          }\n+          msg = 'getFile succeed & file is sending...';\n+          sendFile(targetDevice.address, getRequest.result, msg);\n         };\n \n         getRequest.onerror = function() {\n-          defaultAdapter.sendFile(targetDevice.address, blob);\n-          var msg = 'getFile failed so that blob is sending without filename ' +\n-                    getRequest.error && getRequest.error.name;\n-          debug(msg);\n-          if (--numberOfTasks === 0) {\n-            transferred();\n-          }\n+          msg = 'getFile failed so that blob is sending without filename ' +\n+                getRequest.error && getRequest.error.name;\n+          sendFile(targetDevice.address, blob, msg);\n         };\n+      } else {\n+        // The blob does not have name and filepath,\n+        // pass the blob without name to send file directly.\n+        msg = 'no filepath to get from device storage ' +\n+              'so that blob is sending without filename ';\n+        sendFile(targetDevice.address, blob, msg);\n       }\n     });\n   }\n \n+  /**\n+   * Given address, blob(file), message to send file via platform.\n+   *\n+   * @access private\n+   * @memberOf transfer\n+   * @param {String} address - address of target device\n+   * @param {Object} blob - blob(file) to send\n+   * @param {String} msg - message for debugging only\n+   */\n+  function sendFile(address, blob, msg) {\n+    defaultAdapter.sendFile(address, blob);\n+    debug(msg);\n+    checkTasksComplete();\n+  }","path":"apps/bluetooth/js/transfer.js","position":84,"original_position":84,"commit_id":"cae25978f606e28f08b9c967cea7d69626a0c7a3","original_commit_id":"cae25978f606e28f08b9c967cea7d69626a0c7a3","user":{"login":"davidflanagan","id":516914,"avatar_url":"https://avatars.githubusercontent.com/u/516914?v=3","gravatar_id":"","url":"https://api.github.com/users/davidflanagan","html_url":"https://github.com/davidflanagan","followers_url":"https://api.github.com/users/davidflanagan/followers","following_url":"https://api.github.com/users/davidflanagan/following{/other_user}","gists_url":"https://api.github.com/users/davidflanagan/gists{/gist_id}","starred_url":"https://api.github.com/users/davidflanagan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidflanagan/subscriptions","organizations_url":"https://api.github.com/users/davidflanagan/orgs","repos_url":"https://api.github.com/users/davidflanagan/repos","events_url":"https://api.github.com/users/davidflanagan/events{/privacy}","received_events_url":"https://api.github.com/users/davidflanagan/received_events","type":"User","site_admin":false},"body":"I like having this as a separate function, but think you should move the debug out of it.","created_at":"2015-03-16T18:56:06Z","updated_at":"2015-03-16T18:56:06Z","html_url":"https://github.com/mozilla-b2g/gaia/pull/28884#discussion_r26516195","pull_request_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28884","_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/26516195"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/28884#discussion_r26516195"},"pull_request":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28884"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28884","id":31221312,"html_url":"https://github.com/mozilla-b2g/gaia/pull/28884","diff_url":"https://github.com/mozilla-b2g/gaia/pull/28884.diff","patch_url":"https://github.com/mozilla-b2g/gaia/pull/28884.patch","issue_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28884","number":28884,"state":"open","locked":false,"title":"bug 1140247 - check filepath existed or not before browse file from device storage, r=djf","user":{"login":"ian-liu","id":1704655,"avatar_url":"https://avatars.githubusercontent.com/u/1704655?v=3","gravatar_id":"","url":"https://api.github.com/users/ian-liu","html_url":"https://github.com/ian-liu","followers_url":"https://api.github.com/users/ian-liu/followers","following_url":"https://api.github.com/users/ian-liu/following{/other_user}","gists_url":"https://api.github.com/users/ian-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/ian-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ian-liu/subscriptions","organizations_url":"https://api.github.com/users/ian-liu/orgs","repos_url":"https://api.github.com/users/ian-liu/repos","events_url":"https://api.github.com/users/ian-liu/events{/privacy}","received_events_url":"https://api.github.com/users/ian-liu/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-16T07:17:05Z","updated_at":"2015-03-16T18:56:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"94274f0f321dddb78445d4d25c7557be31c9d4ea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28884/commits","review_comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28884/comments","review_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28884/comments","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/cae25978f606e28f08b9c967cea7d69626a0c7a3","head":{"label":"ian-liu:bluetooth/bug1140247_handle_no_filepath_for_file_sending","ref":"bluetooth/bug1140247_handle_no_filepath_for_file_sending","sha":"cae25978f606e28f08b9c967cea7d69626a0c7a3","user":{"login":"ian-liu","id":1704655,"avatar_url":"https://avatars.githubusercontent.com/u/1704655?v=3","gravatar_id":"","url":"https://api.github.com/users/ian-liu","html_url":"https://github.com/ian-liu","followers_url":"https://api.github.com/users/ian-liu/followers","following_url":"https://api.github.com/users/ian-liu/following{/other_user}","gists_url":"https://api.github.com/users/ian-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/ian-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ian-liu/subscriptions","organizations_url":"https://api.github.com/users/ian-liu/orgs","repos_url":"https://api.github.com/users/ian-liu/repos","events_url":"https://api.github.com/users/ian-liu/events{/privacy}","received_events_url":"https://api.github.com/users/ian-liu/received_events","type":"User","site_admin":false},"repo":{"id":4248255,"name":"gaia","full_name":"ian-liu/gaia","owner":{"login":"ian-liu","id":1704655,"avatar_url":"https://avatars.githubusercontent.com/u/1704655?v=3","gravatar_id":"","url":"https://api.github.com/users/ian-liu","html_url":"https://github.com/ian-liu","followers_url":"https://api.github.com/users/ian-liu/followers","following_url":"https://api.github.com/users/ian-liu/following{/other_user}","gists_url":"https://api.github.com/users/ian-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/ian-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ian-liu/subscriptions","organizations_url":"https://api.github.com/users/ian-liu/orgs","repos_url":"https://api.github.com/users/ian-liu/repos","events_url":"https://api.github.com/users/ian-liu/events{/privacy}","received_events_url":"https://api.github.com/users/ian-liu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ian-liu/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project","fork":true,"url":"https://api.github.com/repos/ian-liu/gaia","forks_url":"https://api.github.com/repos/ian-liu/gaia/forks","keys_url":"https://api.github.com/repos/ian-liu/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ian-liu/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ian-liu/gaia/teams","hooks_url":"https://api.github.com/repos/ian-liu/gaia/hooks","issue_events_url":"https://api.github.com/repos/ian-liu/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/ian-liu/gaia/events","assignees_url":"https://api.github.com/repos/ian-liu/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/ian-liu/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/ian-liu/gaia/tags","blobs_url":"https://api.github.com/repos/ian-liu/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ian-liu/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ian-liu/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/ian-liu/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ian-liu/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/ian-liu/gaia/languages","stargazers_url":"https://api.github.com/repos/ian-liu/gaia/stargazers","contributors_url":"https://api.github.com/repos/ian-liu/gaia/contributors","subscribers_url":"https://api.github.com/repos/ian-liu/gaia/subscribers","subscription_url":"https://api.github.com/repos/ian-liu/gaia/subscription","commits_url":"https://api.github.com/repos/ian-liu/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/ian-liu/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/ian-liu/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/ian-liu/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/ian-liu/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/ian-liu/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ian-liu/gaia/merges","archive_url":"https://api.github.com/repos/ian-liu/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ian-liu/gaia/downloads","issues_url":"https://api.github.com/repos/ian-liu/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/ian-liu/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/ian-liu/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/ian-liu/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ian-liu/gaia/labels{/name}","releases_url":"https://api.github.com/repos/ian-liu/gaia/releases{/id}","created_at":"2012-05-07T09:59:33Z","updated_at":"2014-06-24T03:51:37Z","pushed_at":"2015-03-16T09:58:44Z","git_url":"git://github.com/ian-liu/gaia.git","ssh_url":"git@github.com:ian-liu/gaia.git","clone_url":"https://github.com/ian-liu/gaia.git","svn_url":"https://github.com/ian-liu/gaia","homepage":"https://wiki.mozilla.org/B2G","size":895964,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mozilla-b2g:master","ref":"master","sha":"e0b5b58321fe3549f57bf3f6eb4bb4601b1ce74c","user":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"repo":{"id":2317369,"name":"gaia","full_name":"mozilla-b2g/gaia","owner":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-b2g/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see","fork":false,"url":"https://api.github.com/repos/mozilla-b2g/gaia","forks_url":"https://api.github.com/repos/mozilla-b2g/gaia/forks","keys_url":"https://api.github.com/repos/mozilla-b2g/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-b2g/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-b2g/gaia/teams","hooks_url":"https://api.github.com/repos/mozilla-b2g/gaia/hooks","issue_events_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-b2g/gaia/events","assignees_url":"https://api.github.com/repos/mozilla-b2g/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-b2g/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/tags","blobs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-b2g/gaia/languages","stargazers_url":"https://api.github.com/repos/mozilla-b2g/gaia/stargazers","contributors_url":"https://api.github.com/repos/mozilla-b2g/gaia/contributors","subscribers_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscribers","subscription_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscription","commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-b2g/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-b2g/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-b2g/gaia/merges","archive_url":"https://api.github.com/repos/mozilla-b2g/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-b2g/gaia/downloads","issues_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-b2g/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-b2g/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-b2g/gaia/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-b2g/gaia/releases{/id}","created_at":"2011-09-03T01:38:46Z","updated_at":"2015-03-16T18:47:38Z","pushed_at":"2015-03-16T18:47:47Z","git_url":"git://github.com/mozilla-b2g/gaia.git","ssh_url":"git@github.com:mozilla-b2g/gaia.git","clone_url":"https://github.com/mozilla-b2g/gaia.git","svn_url":"https://github.com/mozilla-b2g/gaia","homepage":"https://wiki.mozilla.org/B2G","size":1455716,"stargazers_count":1890,"watchers_count":1890,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2255,"mirror_url":null,"open_issues_count":911,"forks":2255,"open_issues":911,"watchers":1890,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28884"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/28884"},"issue":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28884"},"comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28884/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28884/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28884/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/cae25978f606e28f08b9c967cea7d69626a0c7a3"}}}}