-
Notifications
You must be signed in to change notification settings - Fork 167
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
Port fix for rejection of empty CAR files #355
Labels
effort/hours
Estimated to take one or several hours
kind/bug
A bug in existing code (including security flaws)
P2
Medium: Good to have, but can wait until someone steps up
Comments
alanshaw
added
kind/bug
A bug in existing code (including security flaws)
P1
High: Likely tackled by core team if no one steps up
need/triage
Needs initial labeling and prioritization
effort/hours
Estimated to take one or several hours
labels
Aug 31, 2021
dchoi27
added
P2
Medium: Good to have, but can wait until someone steps up
and removed
P1
High: Likely tackled by core team if no one steps up
labels
Sep 17, 2021
related to #390 per Alan |
Yeah more precisely #645 will close this |
alanshaw
pushed a commit
that referenced
this issue
Nov 16, 2021
`storeBlob`, `storeDirectory` and `store` now construct CAR files and then call `storeCar` (which `POST`s to `/upload`). This automatically gives them CAR chunking capability. It adds the following **static** functions: ```ts NFTStorage.encodeBlob(blob: Blob): Promise<{ cid: CID, car: CarReader }> NFTStorage.encodeDirectory(files: Blob[]): Promise<{ cid: CID, car: CarReader }> NFTStorage.encodeNFT<T extends TokenInput>(input: T): Promise<{ cid: CID, token: Token<T>, car: CarReader }> ``` After encoding your CAR and obtaining the root CID you can call: ```js await client.storeCar(car) ``` 🚨 There are trade offs here: 1. We're always sending CAR files so our `type` field is going to always be `Car` for uploads from the JS client. To mitigate this we could simply inspect the root node of the CAR, from this we can assertain the type of the data. We should talk about our `type` field and what it means. Right now we've mapped it to the method of upload...lets resolve this and submit a separate PR to fix. FYI, I'm going to be implementing [#355](#355) soon so will be inspecting the root node of the CAR anyway for validation purposes. 2. The `files` property is not set for the `Multipart` or `Nft` type uploads (since it's being uploaded as a CAR). I actually can't see any requests to the `/status/:cid` API (literally 0 - everyone uses `/check/:cid`) in the cloudflare logs which is the only place this data is exposed to users. I don't think folks will miss it. However if we inspect the root node we can get a shallow directory listing to put here. For `Nft` types we can't really set it anymore. There's also a regression right now where we're _not_ setting it anyway. As an aside I'm not sure how much value it has since the data is just a list of file names, without paths within the object that is created... resolves #220
Closed
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
effort/hours
Estimated to take one or several hours
kind/bug
A bug in existing code (including security flaws)
P2
Medium: Good to have, but can wait until someone steps up
web3-storage/web3.storage#344
The text was updated successfully, but these errors were encountered: