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

[WIP] Sanitize get output paths for external file systems #4850

Closed
wants to merge 1 commit into from

Conversation

djdv
Copy link
Contributor

@djdv djdv commented Mar 20, 2018

This allows illegal paths in IPFS to be get-able on Windows, it also accounts for : on Darwin, other platforms need just implement their own sanitize function and alter the build flag if they have special requirements.

Darwin substitutes : with a hyphen - as this is what Finder does if you try to make a file with a colon.

TODO:

  • See if there's a more optimal way to handle this
  • ^ is allowed on Windows/NTFS but not Windows/FAT32, accounting for this requires detecting the output target filesystem.
  • Tests
    Currently I'm manually using a hash generated via cmd (^ is the escape character there)
ipfs files rm -r /test
ipfs files mkdir -p "/test/badnames/:^>*^"bad^|name^"^\*^<:.   "
ipfs files cp /ipfs/QmakyK2Xktmn9HnVGuaDZGtjkPq3HCfmF7SPJVWvTYwduX "/test/badnames/:^>*^"bad^|name^"^\*^<:.   /Is this a file?  ."
ipfs files stat /test

it resolves to QmP6tsejWJczc348FwKncykrRDvbVdXtb3oCCknFMQUii6\badnames\%3A^%3E%2A^bad%7Cname%5C%2A%3C%3A\Is this a file%3F which is ugly but better than failure imo.

@djdv djdv requested a review from Kubuxu as a code owner March 20, 2018 23:38
@ghost ghost assigned djdv Mar 20, 2018
@ghost ghost added the status/in-progress In progress label Mar 20, 2018
This was referenced Mar 20, 2018
License: MIT
Signed-off-by: Dominic Della Valle <ddvpublic@gmail.com>
@djdv
Copy link
Contributor Author

djdv commented Mar 21, 2018

Closing in favour of whyrusleeping/tar-utils#2
I'll make a separate PR for testing get with this later in the go-ipfs repo.

@djdv djdv closed this Mar 21, 2018
@ghost ghost removed the status/in-progress In progress label Mar 21, 2018
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.

1 participant