{"action":"created","issue":{"url":"https://api.github.com/repos/deconst/mapping-service/issues/10","labels_url":"https://api.github.com/repos/deconst/mapping-service/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/deconst/mapping-service/issues/10/comments","events_url":"https://api.github.com/repos/deconst/mapping-service/issues/10/events","html_url":"https://github.com/deconst/mapping-service/pull/10","id":64338859,"number":10,"title":"[wip] Root mapping","user":{"login":"smashwilson","id":17565,"avatar_url":"https://avatars.githubusercontent.com/u/17565?v=3","gravatar_id":"","url":"https://api.github.com/users/smashwilson","html_url":"https://github.com/smashwilson","followers_url":"https://api.github.com/users/smashwilson/followers","following_url":"https://api.github.com/users/smashwilson/following{/other_user}","gists_url":"https://api.github.com/users/smashwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/smashwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smashwilson/subscriptions","organizations_url":"https://api.github.com/users/smashwilson/orgs","repos_url":"https://api.github.com/users/smashwilson/repos","events_url":"https://api.github.com/users/smashwilson/events{/privacy}","received_events_url":"https://api.github.com/users/smashwilson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-25T18:20:06Z","updated_at":"2015-03-25T18:47:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/deconst/mapping-service/pulls/10","html_url":"https://github.com/deconst/mapping-service/pull/10","diff_url":"https://github.com/deconst/mapping-service/pull/10.diff","patch_url":"https://github.com/deconst/mapping-service/pull/10.patch"},"body":"The root page of any mapping is a strange case for the mapping service. I'm trying to figure out the correct way to handle this.\r\n\r\nGiven the following mappings:\r\n\r\n```ini\r\n[domain.com]\r\n\r\n/ https://github.com/root\r\n/foo https://github.com/foo\r\n```\r\n\r\n(Note the lack of trailing slashes, *except* for `/` itself.)\r\n\r\nI believe these are the correct mappings to content IDs:\r\n\r\n * `/` :point_right: `https://github.com/root`\r\n * `/foo` :point_right: `https://github.com/foo`\r\n * `/foobar` :point_right: `https://github.com/root/foobar`\r\n * `/something` :point_right: `https://github.com/root/something`\r\n * `/foo/something` :point_right: `https://github.com/foo/something`\r\n\r\nI'll also need to:\r\n\r\n * Tweak the preparer more, to generate the right content ID for `index.json`\r\n * Change the presenter, to use redirects for `/foo/something/` to `/foo/something`\r\n\r\nI'm also not overly fond of having to special-case the `/` resource like that, but we need some way to address it. Getting the `/foo` and `/foobar` cases to both be correct is going to be finicky, too."},"comment":{"url":"https://api.github.com/repos/deconst/mapping-service/issues/comments/86168804","html_url":"https://github.com/deconst/mapping-service/pull/10#issuecomment-86168804","issue_url":"https://api.github.com/repos/deconst/mapping-service/issues/10","id":86168804,"user":{"login":"smashwilson","id":17565,"avatar_url":"https://avatars.githubusercontent.com/u/17565?v=3","gravatar_id":"","url":"https://api.github.com/users/smashwilson","html_url":"https://github.com/smashwilson","followers_url":"https://api.github.com/users/smashwilson/followers","following_url":"https://api.github.com/users/smashwilson/following{/other_user}","gists_url":"https://api.github.com/users/smashwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/smashwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smashwilson/subscriptions","organizations_url":"https://api.github.com/users/smashwilson/orgs","repos_url":"https://api.github.com/users/smashwilson/repos","events_url":"https://api.github.com/users/smashwilson/events{/privacy}","received_events_url":"https://api.github.com/users/smashwilson/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T18:47:35Z","updated_at":"2015-03-25T18:47:35Z","body":"Okay, I think I've got it.\r\n\r\n * The prefix map stores everything with trailing slashes. This is actually how I already have the map being parsed.\r\n * Always *add* a trailing slash before you perform the map lookup. This ensures that `/foo` correctly maps to `https://github.com/foo` and not `https://github.com/root/foo`, but `/foobar` still maps to `https://github.com/root/foobar`, because `/foo/` isn't a prefix.\r\n * Always *remove* the trailing slash from the lookup's result. This ensures that all content IDs consistently end *without* a trailing slash, which will make the preparer's output make more sense."}}