Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't convert IPFS pins' CIDs #17

Merged
merged 3 commits into from
Nov 24, 2022
Merged

Don't convert IPFS pins' CIDs #17

merged 3 commits into from
Nov 24, 2022

Conversation

djdv
Copy link
Owner

@djdv djdv commented Nov 14, 2022

The original (pre-emptive) intention was to avoid (potential) case-sensitive problems, stemming from a pin's CID.
While this is an okay idea, it's not our problem to solve, and doing so incurs a cost per-request.

Conversions should be left up to the node operator.
If a CID v0 does cause problems, they can upgrade it (once), and use the newer reference instead (removing the necessity of per-request conversions).

This also removes the maintenance need to keep up to date with external CID revisions (in this section of the code).

Extra:
This feature is also something we can add back in on-demand in an external program (like the file explorer shell extension), so that it only happens when it's actually desired.
But the only use case I can imagine for this is if someone wants to copy a reference to a v0 path, and assure it's compliant with non-case-preserving systems.
Seems unlikely, but it shouldn't be a hard problem to deal with later if it does come up.
We'd just use the same logic. Receive a path string, find the CID, convert and replace it, return the new reference.

djdv added 3 commits November 14, 2022 10:04
The original (pre-emptive) intention was to avoid (potential)
case-sensitive problems, stemming from a pin's CID.
While this is an okay idea, it's not our problem to solve, and doing so
incurs a cost per-request. This should be left up to the node operator.
If a CID v0 does cause problems, they can upgrade it (once), and use
the new v1 reference instead (removing the necessity of per-request
conversions).
This also removes the maintenance need to keep up to date with external
CID revisions (in this section of the code).
Only slightly less gross, but still gross.

- [micro-opt] Struct alignment.
- [S&P] Return error values to caller.
- [S&P] Better (?) reference names and ordering.
- [redundancy] Trust the CID string from `fs.FS` path,
  if it passes CID decoding. (Instead of calling the String method
  on the CID instance. These /should/ always match [future footgun].)
@11bw 11bw self-requested a review November 14, 2022 16:46
@djdv djdv merged commit cb79640 into master Nov 24, 2022
@djdv djdv deleted the j/unconvert-pin-cids branch November 24, 2022 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants