Node-solid-server: Wire up LegacyResourceMapper

Created on 3 May 2018  路  9Comments  路  Source: solid/node-solid-server

The LegacyResourceMapper introduced in #660 should replace all inline URL to filename (and vice-versa) mapping, so we:

  • provide consistent mapping behavior all over, and eliminate bugs in existing mapping code (or at least confine those bugs to one place)
  • simplify the transition to the new ResourceMapper (#662)
enhancement inrupt-sprint

Most helpful comment

My heuristic is: everywhere where multiuser is checked.

All 9 comments

We possibly might want to do this by changing the interface of ldp, such that it accepts URLs rather than filenames. Then, ldp itself can call LegacyResourceMapper instead of requiring all of its callers to do that.

Ok, I'm working on this issue now.

I'm still relatively new to the codebase, so I could use some input on where I could find calls that should be changed.
So far, I see the following:

  • [x] [util.js/uriToFileName()](https://github.com/rubensworks/node-solid-server/blob/feature/wire-legacy-resource-mapper-2/lib/utils.js#L70)
  • [x] [util.js/uriToRelativeFilename()](https://github.com/rubensworks/node-solid-server/blob/feature/wire-legacy-resource-mapper-2/lib/utils.js#L87)
  • [x] reqToPath
  • [x] [util.js/getBaseUri()](https://github.com/rubensworks/node-solid-server/blob/feature/wire-legacy-resource-mapper-2/lib/utils.js#L93)
  • [x] [util.js/getFullUri()](https://github.com/rubensworks/node-solid-server/blob/feature/wire-legacy-resource-mapper-2/lib/utils.js#L117)

I assume there may be others as well?

My heuristic is: everywhere where multiuser is checked.

@rubensworks if you're going to edit lib/utils.js, maybe it's a good time those functions to a utility-file in lib/common? Trying to make methods a bit more reusable by putting them in more explicitly named utility-files.

@megoth The plan is actually to remove as much as possible from lib/utils.js :-) In favor of the new methods of ResourceMapper.

But the remaining functions could indeed be moved to lib/common afterwards.

Note that there is stuff in the #911 that is in lib/utils.js too, and it would be nice to avoid conflicts. Not sure we should do that now, perhaps post-5.0.0 if needed?

I assume #911 will be merged before this refactor is done, so I'll have to rebase in any case.

Done in #952.

Was this page helpful?
0 / 5 - 0 ratings