{"action":"created","comment":{"url":"https://api.github.com/repos/syncthing/syncthing/pulls/comments/187525121","pull_request_review_id":119322790,"id":187525121,"diff_hunk":"@@ -186,20 +186,27 @@ func (db *Instance) removeSequences(folder []byte, fs []protocol.FileInfo) {\n }\n \n func (db *Instance) withHave(folder, device, prefix []byte, truncate bool, fn Iterator) {\n+\tif len(prefix) > 0 && !bytes.HasSuffix(prefix, []byte{'/'}) {\n+\t\tf, ok := db.getFileTrunc(db.deviceKey(folder, device, prefix), true)\n+\t\tif !ok {\n+\t\t\t// nothing to be done if the root element doesn't exist\n+\t\t\treturn\n+\t\t}\n+\t\tif !fn(f) {\n+\t\t\treturn\n+\t\t}\n+\t\tprefix = append(prefix, '/')\n+\t}\n+\n \tt := db.newReadOnlyTransaction()\n \tdefer t.close()\n \n \tdbi := t.NewIterator(util.BytesPrefix(db.deviceKey(folder, device, prefix)[:keyPrefixLen+keyFolderLen+keyDeviceLen+len(prefix)]), nil)\n \tdefer dbi.Release()\n \n-\tslashedPrefix := prefix\n-\tif !bytes.HasSuffix(prefix, []byte{'/'}) {\n-\t\tslashedPrefix = append(slashedPrefix, '/')\n-\t}\n-\n \tfor dbi.Next() {\n \t\tname := db.deviceKeyName(dbi.Key())\n-\t\tif len(prefix) > 0 && !bytes.Equal(name, prefix) && !bytes.HasPrefix(name, slashedPrefix) {\n+\t\tif len(prefix) > 0 && !bytes.HasPrefix(name, prefix) {\n \t\t\treturn","path":"lib/db/leveldb_dbinstance.go","position":31,"original_position":31,"commit_id":"bd89977d8b6bfe2930b40353e48731bf2c572ca9","original_commit_id":"bd89977d8b6bfe2930b40353e48731bf2c572ca9","user":{"login":"AudriusButkevicius","id":1144861,"avatar_url":"https://avatars1.githubusercontent.com/u/1144861?v=4","gravatar_id":"","url":"https://api.github.com/users/AudriusButkevicius","html_url":"https://github.com/AudriusButkevicius","followers_url":"https://api.github.com/users/AudriusButkevicius/followers","following_url":"https://api.github.com/users/AudriusButkevicius/following{/other_user}","gists_url":"https://api.github.com/users/AudriusButkevicius/gists{/gist_id}","starred_url":"https://api.github.com/users/AudriusButkevicius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudriusButkevicius/subscriptions","organizations_url":"https://api.github.com/users/AudriusButkevicius/orgs","repos_url":"https://api.github.com/users/AudriusButkevicius/repos","events_url":"https://api.github.com/users/AudriusButkevicius/events{/privacy}","received_events_url":"https://api.github.com/users/AudriusButkevicius/received_events","type":"User","site_admin":false},"body":"So this no longer walks the directory itself? I think that's not how it should work, as I think walk returns the directory.","created_at":"2018-05-11T05:49:04Z","updated_at":"2018-05-11T05:52:34Z","html_url":"https://github.com/syncthing/syncthing/pull/4940#discussion_r187525121","pull_request_url":"https://api.github.com/repos/syncthing/syncthing/pulls/4940","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/comments/187525121"},"html":{"href":"https://github.com/syncthing/syncthing/pull/4940#discussion_r187525121"},"pull_request":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/4940"}}},"pull_request":{"url":"https://api.github.com/repos/syncthing/syncthing/pulls/4940","id":187326836,"html_url":"https://github.com/syncthing/syncthing/pull/4940","diff_url":"https://github.com/syncthing/syncthing/pull/4940.diff","patch_url":"https://github.com/syncthing/syncthing/pull/4940.patch","issue_url":"https://api.github.com/repos/syncthing/syncthing/issues/4940","number":4940,"state":"open","locked":false,"title":"lib/db: Fix prefixed walks (fixes #4925)","user":{"login":"imsodin","id":15955093,"avatar_url":"https://avatars0.githubusercontent.com/u/15955093?v=4","gravatar_id":"","url":"https://api.github.com/users/imsodin","html_url":"https://github.com/imsodin","followers_url":"https://api.github.com/users/imsodin/followers","following_url":"https://api.github.com/users/imsodin/following{/other_user}","gists_url":"https://api.github.com/users/imsodin/gists{/gist_id}","starred_url":"https://api.github.com/users/imsodin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imsodin/subscriptions","organizations_url":"https://api.github.com/users/imsodin/orgs","repos_url":"https://api.github.com/users/imsodin/repos","events_url":"https://api.github.com/users/imsodin/events{/privacy}","received_events_url":"https://api.github.com/users/imsodin/received_events","type":"User","site_admin":false},"body":"### Purpose\r\n\r\nCurrently walking the db with a prefix is broken in the presence of a file, that has the same prefix, as the entire walk is aborted when such a file is encountered.\r\n\r\n### Testing\r\n\r\nAdded new unit test.","created_at":"2018-05-10T22:45:18Z","updated_at":"2018-05-11T05:52:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a269b3ccd06b0c92a258e3c15806f30347d98f56","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/syncthing/syncthing/pulls/4940/commits","review_comments_url":"https://api.github.com/repos/syncthing/syncthing/pulls/4940/comments","review_comment_url":"https://api.github.com/repos/syncthing/syncthing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/syncthing/syncthing/issues/4940/comments","statuses_url":"https://api.github.com/repos/syncthing/syncthing/statuses/bd89977d8b6bfe2930b40353e48731bf2c572ca9","head":{"label":"imsodin:fix-4925","ref":"fix-4925","sha":"bd89977d8b6bfe2930b40353e48731bf2c572ca9","user":{"login":"imsodin","id":15955093,"avatar_url":"https://avatars0.githubusercontent.com/u/15955093?v=4","gravatar_id":"","url":"https://api.github.com/users/imsodin","html_url":"https://github.com/imsodin","followers_url":"https://api.github.com/users/imsodin/followers","following_url":"https://api.github.com/users/imsodin/following{/other_user}","gists_url":"https://api.github.com/users/imsodin/gists{/gist_id}","starred_url":"https://api.github.com/users/imsodin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imsodin/subscriptions","organizations_url":"https://api.github.com/users/imsodin/orgs","repos_url":"https://api.github.com/users/imsodin/repos","events_url":"https://api.github.com/users/imsodin/events{/privacy}","received_events_url":"https://api.github.com/users/imsodin/received_events","type":"User","site_admin":false},"repo":{"id":71178615,"name":"syncthing","full_name":"imsodin/syncthing","owner":{"login":"imsodin","id":15955093,"avatar_url":"https://avatars0.githubusercontent.com/u/15955093?v=4","gravatar_id":"","url":"https://api.github.com/users/imsodin","html_url":"https://github.com/imsodin","followers_url":"https://api.github.com/users/imsodin/followers","following_url":"https://api.github.com/users/imsodin/following{/other_user}","gists_url":"https://api.github.com/users/imsodin/gists{/gist_id}","starred_url":"https://api.github.com/users/imsodin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imsodin/subscriptions","organizations_url":"https://api.github.com/users/imsodin/orgs","repos_url":"https://api.github.com/users/imsodin/repos","events_url":"https://api.github.com/users/imsodin/events{/privacy}","received_events_url":"https://api.github.com/users/imsodin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/imsodin/syncthing","description":"Open Source Continuous File Synchronization","fork":true,"url":"https://api.github.com/repos/imsodin/syncthing","forks_url":"https://api.github.com/repos/imsodin/syncthing/forks","keys_url":"https://api.github.com/repos/imsodin/syncthing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/imsodin/syncthing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/imsodin/syncthing/teams","hooks_url":"https://api.github.com/repos/imsodin/syncthing/hooks","issue_events_url":"https://api.github.com/repos/imsodin/syncthing/issues/events{/number}","events_url":"https://api.github.com/repos/imsodin/syncthing/events","assignees_url":"https://api.github.com/repos/imsodin/syncthing/assignees{/user}","branches_url":"https://api.github.com/repos/imsodin/syncthing/branches{/branch}","tags_url":"https://api.github.com/repos/imsodin/syncthing/tags","blobs_url":"https://api.github.com/repos/imsodin/syncthing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/imsodin/syncthing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/imsodin/syncthing/git/refs{/sha}","trees_url":"https://api.github.com/repos/imsodin/syncthing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/imsodin/syncthing/statuses/{sha}","languages_url":"https://api.github.com/repos/imsodin/syncthing/languages","stargazers_url":"https://api.github.com/repos/imsodin/syncthing/stargazers","contributors_url":"https://api.github.com/repos/imsodin/syncthing/contributors","subscribers_url":"https://api.github.com/repos/imsodin/syncthing/subscribers","subscription_url":"https://api.github.com/repos/imsodin/syncthing/subscription","commits_url":"https://api.github.com/repos/imsodin/syncthing/commits{/sha}","git_commits_url":"https://api.github.com/repos/imsodin/syncthing/git/commits{/sha}","comments_url":"https://api.github.com/repos/imsodin/syncthing/comments{/number}","issue_comment_url":"https://api.github.com/repos/imsodin/syncthing/issues/comments{/number}","contents_url":"https://api.github.com/repos/imsodin/syncthing/contents/{+path}","compare_url":"https://api.github.com/repos/imsodin/syncthing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/imsodin/syncthing/merges","archive_url":"https://api.github.com/repos/imsodin/syncthing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/imsodin/syncthing/downloads","issues_url":"https://api.github.com/repos/imsodin/syncthing/issues{/number}","pulls_url":"https://api.github.com/repos/imsodin/syncthing/pulls{/number}","milestones_url":"https://api.github.com/repos/imsodin/syncthing/milestones{/number}","notifications_url":"https://api.github.com/repos/imsodin/syncthing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/imsodin/syncthing/labels{/name}","releases_url":"https://api.github.com/repos/imsodin/syncthing/releases{/id}","deployments_url":"https://api.github.com/repos/imsodin/syncthing/deployments","created_at":"2016-10-17T20:31:36Z","updated_at":"2016-10-17T20:31:39Z","pushed_at":"2018-05-10T22:41:09Z","git_url":"git://github.com/imsodin/syncthing.git","ssh_url":"git@github.com:imsodin/syncthing.git","clone_url":"https://github.com/imsodin/syncthing.git","svn_url":"https://github.com/imsodin/syncthing","homepage":"http://forum.syncthing.net/","size":96949,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"syncthing:master","ref":"master","sha":"a2f51c85c2748fa392193b31c2734b92198ed7d0","user":{"login":"syncthing","id":7628018,"avatar_url":"https://avatars0.githubusercontent.com/u/7628018?v=4","gravatar_id":"","url":"https://api.github.com/users/syncthing","html_url":"https://github.com/syncthing","followers_url":"https://api.github.com/users/syncthing/followers","following_url":"https://api.github.com/users/syncthing/following{/other_user}","gists_url":"https://api.github.com/users/syncthing/gists{/gist_id}","starred_url":"https://api.github.com/users/syncthing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syncthing/subscriptions","organizations_url":"https://api.github.com/users/syncthing/orgs","repos_url":"https://api.github.com/users/syncthing/repos","events_url":"https://api.github.com/users/syncthing/events{/privacy}","received_events_url":"https://api.github.com/users/syncthing/received_events","type":"Organization","site_admin":false},"repo":{"id":14712850,"name":"syncthing","full_name":"syncthing/syncthing","owner":{"login":"syncthing","id":7628018,"avatar_url":"https://avatars0.githubusercontent.com/u/7628018?v=4","gravatar_id":"","url":"https://api.github.com/users/syncthing","html_url":"https://github.com/syncthing","followers_url":"https://api.github.com/users/syncthing/followers","following_url":"https://api.github.com/users/syncthing/following{/other_user}","gists_url":"https://api.github.com/users/syncthing/gists{/gist_id}","starred_url":"https://api.github.com/users/syncthing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syncthing/subscriptions","organizations_url":"https://api.github.com/users/syncthing/orgs","repos_url":"https://api.github.com/users/syncthing/repos","events_url":"https://api.github.com/users/syncthing/events{/privacy}","received_events_url":"https://api.github.com/users/syncthing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/syncthing/syncthing","description":"Open Source Continuous File Synchronization","fork":false,"url":"https://api.github.com/repos/syncthing/syncthing","forks_url":"https://api.github.com/repos/syncthing/syncthing/forks","keys_url":"https://api.github.com/repos/syncthing/syncthing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/syncthing/syncthing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/syncthing/syncthing/teams","hooks_url":"https://api.github.com/repos/syncthing/syncthing/hooks","issue_events_url":"https://api.github.com/repos/syncthing/syncthing/issues/events{/number}","events_url":"https://api.github.com/repos/syncthing/syncthing/events","assignees_url":"https://api.github.com/repos/syncthing/syncthing/assignees{/user}","branches_url":"https://api.github.com/repos/syncthing/syncthing/branches{/branch}","tags_url":"https://api.github.com/repos/syncthing/syncthing/tags","blobs_url":"https://api.github.com/repos/syncthing/syncthing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/syncthing/syncthing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/syncthing/syncthing/git/refs{/sha}","trees_url":"https://api.github.com/repos/syncthing/syncthing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/syncthing/syncthing/statuses/{sha}","languages_url":"https://api.github.com/repos/syncthing/syncthing/languages","stargazers_url":"https://api.github.com/repos/syncthing/syncthing/stargazers","contributors_url":"https://api.github.com/repos/syncthing/syncthing/contributors","subscribers_url":"https://api.github.com/repos/syncthing/syncthing/subscribers","subscription_url":"https://api.github.com/repos/syncthing/syncthing/subscription","commits_url":"https://api.github.com/repos/syncthing/syncthing/commits{/sha}","git_commits_url":"https://api.github.com/repos/syncthing/syncthing/git/commits{/sha}","comments_url":"https://api.github.com/repos/syncthing/syncthing/comments{/number}","issue_comment_url":"https://api.github.com/repos/syncthing/syncthing/issues/comments{/number}","contents_url":"https://api.github.com/repos/syncthing/syncthing/contents/{+path}","compare_url":"https://api.github.com/repos/syncthing/syncthing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/syncthing/syncthing/merges","archive_url":"https://api.github.com/repos/syncthing/syncthing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/syncthing/syncthing/downloads","issues_url":"https://api.github.com/repos/syncthing/syncthing/issues{/number}","pulls_url":"https://api.github.com/repos/syncthing/syncthing/pulls{/number}","milestones_url":"https://api.github.com/repos/syncthing/syncthing/milestones{/number}","notifications_url":"https://api.github.com/repos/syncthing/syncthing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/syncthing/syncthing/labels{/name}","releases_url":"https://api.github.com/repos/syncthing/syncthing/releases{/id}","deployments_url":"https://api.github.com/repos/syncthing/syncthing/deployments","created_at":"2013-11-26T09:48:21Z","updated_at":"2018-05-11T02:04:52Z","pushed_at":"2018-05-10T22:45:19Z","git_url":"git://github.com/syncthing/syncthing.git","ssh_url":"git@github.com:syncthing/syncthing.git","clone_url":"https://github.com/syncthing/syncthing.git","svn_url":"https://github.com/syncthing/syncthing","homepage":"https://forum.syncthing.net/","size":95244,"stargazers_count":20436,"watchers_count":20436,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1743,"mirror_url":null,"archived":false,"open_issues_count":236,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":1743,"open_issues":236,"watchers":20436,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/4940"},"html":{"href":"https://github.com/syncthing/syncthing/pull/4940"},"issue":{"href":"https://api.github.com/repos/syncthing/syncthing/issues/4940"},"comments":{"href":"https://api.github.com/repos/syncthing/syncthing/issues/4940/comments"},"review_comments":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/4940/comments"},"review_comment":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/4940/commits"},"statuses":{"href":"https://api.github.com/repos/syncthing/syncthing/statuses/bd89977d8b6bfe2930b40353e48731bf2c572ca9"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"AudriusButkevicius"}}