Skip to content

Commit

Permalink
clarification on how to interpret relative URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Jul 7, 2018
1 parent c0001a6 commit f3b8f78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ ctrl: {
}
```

The `ctrl.params.url` contains the location of the uploaded file relative to the main server.
The `ctrl.params.url` contains the location of the uploaded file relative to the *download* endpoint `/v0/file/s/` at the current HTTP server.

Once the `url` is received, either immediately or after following the redirect, the client can use the `url` to send a `{pub}` message with the uploaded file as an attachment. The `url` should be used to produce a [Drafty](./drafty.md)-formatted `pub.content` field and also should be referenced in the `pub.head.attachments`:

Expand Down Expand Up @@ -970,4 +970,4 @@ It's important to list the URLs in the `head.attachments` field. Tinode server u

### Downloading

The default serving endpoint `v0/file/s` serves files in response to HTTP GET requests. As a security measure, the client should not send security credentials if the download URL is absolute and leads to another server.
The serving endpoint `/v0/file/s` serves files in response to HTTP GET requests. The client must evaluate relative URLs against this endpoint, i.e. if it receives a URL `mfHLxDWFhfU.pdf` or `./mfHLxDWFhfU.pdf` it should interpret it as a path `/v0/file/s/mfHLxDWFhfU.pdf` at the current Tinode HTTP server. As a security measure, the client should not send security credentials if the download URL is absolute and leads to another server.

0 comments on commit f3b8f78

Please sign in to comment.