Add using HTTP api with nocopy

I am trying to add a file using http. I am sending the request with the nocopy request parameter. I am specifying the Abspath header for the files and sending the empty multipart:
Abspath: /some/path/f.txt
Content-Disposition: form-data; name=“file”; filename=“f.txt”
Content-Type: application/octet-stream


I expect that ipfs is going to read the file from the directory and return its hash,
but I am getting:

And I am getting an empty file, when reading from ipfs.

It looks like ipfs saves the data I send in the request (which is empty, 0 bytes), and ignores the file I specify with Abspath. Am I right? Is that possible to add a file with http api without sending the whole file via the network? As ipfs already has the path to the file, it looks natural for me not to send it over the net (I am planning to add big files of 1GB and more).

You need to send the actual data. Otherwise, an attacker with access to your API could add arbitrary files on your system to IPFS. An attacker with access to your API could still confirm that you have some file with some specific content, but at least they can’t read the file.

Why then, it returns success when I send the data (empty body) which is not the same a the file? It should have returned an error, that the data in the request is not the same as the data in the file.

aaahhh, ok. thanks :slight_smile: