{"action":"closed","number":19,"pull_request":{"url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/pulls/19","id":38430887,"html_url":"https://github.com/rickharrison/broccoli-asset-rewrite/pull/19","diff_url":"https://github.com/rickharrison/broccoli-asset-rewrite/pull/19.diff","patch_url":"https://github.com/rickharrison/broccoli-asset-rewrite/pull/19.patch","issue_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/issues/19","number":19,"state":"closed","locked":false,"title":"Make asset match regex more strict for cases where filename occurs multiple times in project and is suffixed onto cdn url","user":{"login":"adamjmcgrath","id":1299658,"avatar_url":"https://avatars.githubusercontent.com/u/1299658?v=3","gravatar_id":"","url":"https://api.github.com/users/adamjmcgrath","html_url":"https://github.com/adamjmcgrath","followers_url":"https://api.github.com/users/adamjmcgrath/followers","following_url":"https://api.github.com/users/adamjmcgrath/following{/other_user}","gists_url":"https://api.github.com/users/adamjmcgrath/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjmcgrath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjmcgrath/subscriptions","organizations_url":"https://api.github.com/users/adamjmcgrath/orgs","repos_url":"https://api.github.com/users/adamjmcgrath/repos","events_url":"https://api.github.com/users/adamjmcgrath/events{/privacy}","received_events_url":"https://api.github.com/users/adamjmcgrath/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\nThe CDN we use puts the unique part of the url in the path before the assets filename, so `myasset.jpg` when uploaded becomes `http://mycdn.com/f00b4rXy/myasset.jpg`\r\n\r\nThis becomes an issue when we have an asset in the root of the dist folder with the same name as an asset in a sub directory.\r\n\r\nBasically when `rewriteAssetPath` get's called with arguments like:\r\n\r\n```javascript\r\n// string - '<img src=\"http://mycdn.com/f00b4rXy/myasset.jpg\">' (Already revved correctly with the asset in the sub directory)\r\n// assetPath - 'myasset.jpg' (The asset in the root directory)\r\n// replacementPath - 'http://mycdn.com/bazQuxAbc/myasset.jpg' (The revved asset name in the root directory)\r\nAssetRewrite.prototype.rewriteAssetPath = function (string, assetPath, replacementPath) {\r\n```\r\n\r\nThis section of the regex: `[^\"\\'\\\\(\\\\)=]*` (https://github.com/rickharrison/broccoli-asset-rewrite/blob/master/index.js#L93) matches `http://mycdn.com/f00b4rXy/` and the string gets revved again to the wrong url (the one for the root `myasset.jpg` rather than the `sub-directory/myasset.js`)\r\n\r\nApologies for the convoluted explanation - it may be easier just to look at the test case in this PR.\r\n\r\nLooking at that regex, it looks to me that the only reason for this section `[^\"\\'\\\\(\\\\)=]*` is to ignore the `./` at the beginning of a row, so `./assets/script.js` gets replaced by the replacement for `assets/script.js`\r\n\r\nIf this is the case, this PR proposes that the match is more specific and we explicitly ignore this case instead `(?:\\.\\/)?`\r\n\r\nLet me know if I've missed any other use cases for that rule in the regex.\r\n\r\n","created_at":"2015-06-24T11:10:50Z","updated_at":"2015-06-26T08:29:11Z","closed_at":"2015-06-26T08:29:11Z","merged_at":null,"merge_commit_sha":"091a37ef451c0d2fdb0a2b0d93c5c3030750c5e5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/pulls/19/commits","review_comments_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/pulls/19/comments","review_comment_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/issues/19/comments","statuses_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/statuses/d96c1cd5d7a301c29c509d28c5d50d812b76e589","head":{"label":"adamjmcgrath:duplicate-filenames","ref":"duplicate-filenames","sha":"d96c1cd5d7a301c29c509d28c5d50d812b76e589","user":{"login":"adamjmcgrath","id":1299658,"avatar_url":"https://avatars.githubusercontent.com/u/1299658?v=3","gravatar_id":"","url":"https://api.github.com/users/adamjmcgrath","html_url":"https://github.com/adamjmcgrath","followers_url":"https://api.github.com/users/adamjmcgrath/followers","following_url":"https://api.github.com/users/adamjmcgrath/following{/other_user}","gists_url":"https://api.github.com/users/adamjmcgrath/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjmcgrath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjmcgrath/subscriptions","organizations_url":"https://api.github.com/users/adamjmcgrath/orgs","repos_url":"https://api.github.com/users/adamjmcgrath/repos","events_url":"https://api.github.com/users/adamjmcgrath/events{/privacy}","received_events_url":"https://api.github.com/users/adamjmcgrath/received_events","type":"User","site_admin":false},"repo":{"id":37928436,"name":"broccoli-asset-rewrite","full_name":"adamjmcgrath/broccoli-asset-rewrite","owner":{"login":"adamjmcgrath","id":1299658,"avatar_url":"https://avatars.githubusercontent.com/u/1299658?v=3","gravatar_id":"","url":"https://api.github.com/users/adamjmcgrath","html_url":"https://github.com/adamjmcgrath","followers_url":"https://api.github.com/users/adamjmcgrath/followers","following_url":"https://api.github.com/users/adamjmcgrath/following{/other_user}","gists_url":"https://api.github.com/users/adamjmcgrath/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjmcgrath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjmcgrath/subscriptions","organizations_url":"https://api.github.com/users/adamjmcgrath/orgs","repos_url":"https://api.github.com/users/adamjmcgrath/repos","events_url":"https://api.github.com/users/adamjmcgrath/events{/privacy}","received_events_url":"https://api.github.com/users/adamjmcgrath/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adamjmcgrath/broccoli-asset-rewrite","description":"Broccoli plugin to rewrite a source tree from an asset map.","fork":true,"url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite","forks_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/forks","keys_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/teams","hooks_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/hooks","issue_events_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/issues/events{/number}","events_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/events","assignees_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/assignees{/user}","branches_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/branches{/branch}","tags_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/tags","blobs_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/statuses/{sha}","languages_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/languages","stargazers_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/stargazers","contributors_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/contributors","subscribers_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/subscribers","subscription_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/subscription","commits_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/issues/comments{/number}","contents_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/contents/{+path}","compare_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/merges","archive_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/downloads","issues_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/issues{/number}","pulls_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/pulls{/number}","milestones_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/milestones{/number}","notifications_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/labels{/name}","releases_url":"https://api.github.com/repos/adamjmcgrath/broccoli-asset-rewrite/releases{/id}","created_at":"2015-06-23T15:42:02Z","updated_at":"2015-06-23T15:42:03Z","pushed_at":"2015-06-24T10:51:30Z","git_url":"git://github.com/adamjmcgrath/broccoli-asset-rewrite.git","ssh_url":"git@github.com:adamjmcgrath/broccoli-asset-rewrite.git","clone_url":"https://github.com/adamjmcgrath/broccoli-asset-rewrite.git","svn_url":"https://github.com/adamjmcgrath/broccoli-asset-rewrite","homepage":"","size":329,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rickharrison:master","ref":"master","sha":"c4d905df75ad54db0af6f740bb0a8a352a88e78b","user":{"login":"rickharrison","id":22048,"avatar_url":"https://avatars.githubusercontent.com/u/22048?v=3","gravatar_id":"","url":"https://api.github.com/users/rickharrison","html_url":"https://github.com/rickharrison","followers_url":"https://api.github.com/users/rickharrison/followers","following_url":"https://api.github.com/users/rickharrison/following{/other_user}","gists_url":"https://api.github.com/users/rickharrison/gists{/gist_id}","starred_url":"https://api.github.com/users/rickharrison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickharrison/subscriptions","organizations_url":"https://api.github.com/users/rickharrison/orgs","repos_url":"https://api.github.com/users/rickharrison/repos","events_url":"https://api.github.com/users/rickharrison/events{/privacy}","received_events_url":"https://api.github.com/users/rickharrison/received_events","type":"User","site_admin":false},"repo":{"id":21450938,"name":"broccoli-asset-rewrite","full_name":"rickharrison/broccoli-asset-rewrite","owner":{"login":"rickharrison","id":22048,"avatar_url":"https://avatars.githubusercontent.com/u/22048?v=3","gravatar_id":"","url":"https://api.github.com/users/rickharrison","html_url":"https://github.com/rickharrison","followers_url":"https://api.github.com/users/rickharrison/followers","following_url":"https://api.github.com/users/rickharrison/following{/other_user}","gists_url":"https://api.github.com/users/rickharrison/gists{/gist_id}","starred_url":"https://api.github.com/users/rickharrison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickharrison/subscriptions","organizations_url":"https://api.github.com/users/rickharrison/orgs","repos_url":"https://api.github.com/users/rickharrison/repos","events_url":"https://api.github.com/users/rickharrison/events{/privacy}","received_events_url":"https://api.github.com/users/rickharrison/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rickharrison/broccoli-asset-rewrite","description":"Broccoli plugin to rewrite a source tree from an asset map.","fork":false,"url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite","forks_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/forks","keys_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/teams","hooks_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/hooks","issue_events_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/issues/events{/number}","events_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/events","assignees_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/assignees{/user}","branches_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/branches{/branch}","tags_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/tags","blobs_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/git/refs{/sha}","trees_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/statuses/{sha}","languages_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/languages","stargazers_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/stargazers","contributors_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/contributors","subscribers_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/subscribers","subscription_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/subscription","commits_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/commits{/sha}","git_commits_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/git/commits{/sha}","comments_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/comments{/number}","issue_comment_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/issues/comments{/number}","contents_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/contents/{+path}","compare_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/merges","archive_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/downloads","issues_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/issues{/number}","pulls_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/pulls{/number}","milestones_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/milestones{/number}","notifications_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/labels{/name}","releases_url":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/releases{/id}","created_at":"2014-07-03T05:33:06Z","updated_at":"2015-04-12T09:43:13Z","pushed_at":"2015-06-24T11:10:50Z","git_url":"git://github.com/rickharrison/broccoli-asset-rewrite.git","ssh_url":"git@github.com:rickharrison/broccoli-asset-rewrite.git","clone_url":"https://github.com/rickharrison/broccoli-asset-rewrite.git","svn_url":"https://github.com/rickharrison/broccoli-asset-rewrite","homepage":"","size":329,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":1,"forks":11,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/pulls/19"},"html":{"href":"https://github.com/rickharrison/broccoli-asset-rewrite/pull/19"},"issue":{"href":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/issues/19"},"comments":{"href":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/rickharrison/broccoli-asset-rewrite/statuses/d96c1cd5d7a301c29c509d28c5d50d812b76e589"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":9,"review_comments":0,"commits":1,"additions":23,"deletions":2,"changed_files":6}}