Skip to content

Commit

Permalink
Fix review feedback.
Browse files Browse the repository at this point in the history
- Fixed endianness bug in gateway file parsing
- Use IPFS_PATH in tests where IPFS_DATA was used
- Fixed typos from traling -> trailing
- Fixed broken link in IPFS.md
  • Loading branch information
markg85 committed Nov 11, 2023
1 parent 1af46f2 commit 9817e97
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/IPFS.md
Expand Up @@ -69,7 +69,7 @@ If you trust this behavior from your gateway of choice then passing the `-L` opt
Depending on the arguments, cURL could present the user with an error.

### Gateway file and environment variable
cURL tried to look for the file: `~/.ipfs/gateway` but couldn't find it. It also tried to look for the `IPFS_GATEWAY` environment variable but couldn't find that either. This happens when no extra arguments are passed to cURL and letting it try to figure it out [automatically](#Automatic-gateway-detection).
cURL tried to look for the file: `~/.ipfs/gateway` but couldn't find it. It also tried to look for the `IPFS_GATEWAY` environment variable but couldn't find that either. This happens when no extra arguments are passed to cURL and letting it try to figure it out [automatically](#automatic-gateway-detection).

Any IPFS implementation that has gateway support should expose it's URL in `~/.ipfs/gateway`. If you are already running a gateway, make sure it exposes the file where cURL expects to find it.

Expand Down
3 changes: 2 additions & 1 deletion src/tool_ipfs.c
Expand Up @@ -104,7 +104,8 @@ static char *ipfs_gateway(void)

/* get the first line of the gateway file, ignore the rest */
while((c = getc(gateway_file)) != EOF && c != '\n' && c != '\r') {
if(curlx_dyn_addn(&dyn, &c, 1))
char c_char = (char)c;
if(curlx_dyn_addn(&dyn, &c_char, 1))
goto fail;
}

Expand Down
5 changes: 2 additions & 3 deletions tests/data/test736
Expand Up @@ -31,11 +31,10 @@ Hello curl from IPFS
http
</server>
<setenv>
HOME=%PWD/%LOGDIR
IPFS_DATA=$HOME/.ipfs
IPFS_PATH=%LOGDIR/.ipfs
</setenv>
<name>
IPFS with IPFS_DATA set, no traling slash
IPFS with IPFS_PATH set, no trailing slash
</name>
<command>
ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u
Expand Down
5 changes: 2 additions & 3 deletions tests/data/test737
Expand Up @@ -31,11 +31,10 @@ Hello curl from IPFS
http
</server>
<setenv>
HOME=%PWD/%LOGDIR
IPFS_DATA=$HOME/.ipfs/
IPFS_PATH=%LOGDIR/.ipfs/
</setenv>
<name>
IPFS with IPFS_DATA set, with traling slash
IPFS with IPFS_PATH set, with trailing slash
</name>
<command>
ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u
Expand Down
5 changes: 2 additions & 3 deletions tests/data/test738
Expand Up @@ -17,11 +17,10 @@ IPFS
http
</server>
<setenv>
HOME=%PWD/%LOGDIR
IPFS_DATA=%HOME/.ipfs/
IPFS_PATH=%LOGDIR/.ipfs/
</setenv>
<name>
IPFS with IPFS_DATA, no gateway file
IPFS with IPFS_PATH, no gateway file
</name>
<command>
ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u
Expand Down

0 comments on commit 9817e97

Please sign in to comment.