Title: Get ResourceMapper back to its minimal interface · Issue #1212 · nodeSolidServer/node-solid-server · GitHub
Open Graph Title: Get ResourceMapper back to its minimal interface · Issue #1212 · nodeSolidServer/node-solid-server
X Title: Get ResourceMapper back to its minimal interface · Issue #1212 · nodeSolidServer/node-solid-server
Description: The purpose of ResourceMapper was to put the knowledge for URL-to-file and file-to-URL conversion in one place and one place only. That's why only two methods were exposed: mapUrlToFile and mapFileToUrl, and they were very deeply tested....
Open Graph Description: The purpose of ResourceMapper was to put the knowledge for URL-to-file and file-to-URL conversion in one place and one place only. That's why only two methods were exposed: mapUrlToFile and mapFile...
X Description: The purpose of ResourceMapper was to put the knowledge for URL-to-file and file-to-URL conversion in one place and one place only. That's why only two methods were exposed: mapUrlToFile and map...
Opengraph URL: https://github.com/nodeSolidServer/node-solid-server/issues/1212
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get ResourceMapper back to its minimal interface","articleBody":"The purpose of `ResourceMapper` was to put the knowledge for URL-to-file and file-to-URL conversion in one place and one place only. That's why only two methods were exposed: `mapUrlToFile` and `mapFileToUrl`, and they were very deeply tested. This avoided a whole range of bugs caused by spaces, escapes, etc. You can see this old state [here](https://github.com/solid/node-solid-server/blob/51ee61e7d9b89f48db957f7eadee5ca120f892c8/lib/resource-mapper.js).\r\n\r\nHowever, [later versions](https://github.com/solid/node-solid-server/blob/v5.1.1/lib/resource-mapper.js) started exposing extra methods, such as `resolveUrl`, `getFullPath`.\r\n\r\nOn the one hand, it is uncertain whether these are as well-tested. On the other hand, it leads to modules again [rolling their own resolving](https://github.com/solid/node-solid-server/blob/bdc5acba326f215c3d32eb2b234ec73d0f5cc9ce/lib/handlers/put.js#L39-L40) and introducing errors in the process. @timbl has found cases where URLs suddenly have unescaped spaces and are thus invalid (#1211). In the linked example, we see a bug happening:\r\n\r\n```javascript\r\n// This is a file path (unescaped spaces)\r\nconst path = ldp.resourceMapper.getFullPath(req)\r\n// Woops, now suddenly it is a URL (invalid, because unescaped spaces!)\r\nconst requestUri = await ldp.resourceMapper.resolveUrl(req.hostname, path)\r\n```\r\n\r\nPropose resolution: do not expose `resolveUrl` and `getFullPath` (underscore them); only `mapUrlToFile` and `mapFileToUrl` should be used.","author":{"url":"https://github.com/RubenVerborgh","@type":"Person","name":"RubenVerborgh"},"datePublished":"2019-06-01T22:59:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1212/node-solid-server/issues/1212"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6373099a-1fd2-8fdb-8815-2839fa20c6ba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AB72:3CECC8:DA54ACE:11C978BF:6976A8D0 |
| html-safe-nonce | bd6b2f7a86259e3ca9b7192de7c6d0a313c0ad076a9ea3e870185a0d66575930 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQjcyOjNDRUNDODpEQTU0QUNFOjExQzk3OEJGOjY5NzZBOEQwIiwidmlzaXRvcl9pZCI6IjQ5OTU2ODI0MjAzMTM3MjkyMzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 84b162f22b7943efb1cb6a5dd1f8c47a500449d57e2e02a44e6a2522963a4503 |
| hovercard-subject-tag | issue:451132647 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodeSolidServer/node-solid-server/1212/issue_layout |
| twitter:image | https://opengraph.githubassets.com/765f6072ca32cb2dd2ffd771674d5d32d39f1c5e6900178aad3de7cdf1ca949b/nodeSolidServer/node-solid-server/issues/1212 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/765f6072ca32cb2dd2ffd771674d5d32d39f1c5e6900178aad3de7cdf1ca949b/nodeSolidServer/node-solid-server/issues/1212 |
| og:image:alt | The purpose of ResourceMapper was to put the knowledge for URL-to-file and file-to-URL conversion in one place and one place only. That's why only two methods were exposed: mapUrlToFile and mapFile... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RubenVerborgh |
| hostname | github.com |
| expected-hostname | github.com |
| None | 032152924a283b83384255d9489e7b93b54ba01da8d380b05ecd3953b3212411 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodeSolidServer/node-solid-server git https://github.com/nodeSolidServer/node-solid-server.git |
| octolytics-dimension-user_id | 104446421 |
| octolytics-dimension-user_login | nodeSolidServer |
| octolytics-dimension-repository_id | 24306004 |
| octolytics-dimension-repository_nwo | nodeSolidServer/node-solid-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24306004 |
| octolytics-dimension-repository_network_root_nwo | nodeSolidServer/node-solid-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5b577f6be6482e336e3c30e8daefa30144947b17 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width