fix error checking when file is not found

This commit is contained in:
or-else
2018-08-23 19:02:36 +03:00
parent 045b1aac25
commit 0736f7f4b2
2 changed files with 10 additions and 9 deletions

View File

@ -9,7 +9,7 @@ Version 0.15. This is beta-quality software: feature-complete but probably with
## Why?
The promise of [XMPP](http://xmpp.org/) was to deliver federated instant messaging: anyone would be able to spin up an IM server capable of exchanging messages with any other XMPP server in the world. Unfortunately XMPP never delivered on this promse. Instant messengers are still a bunch of incompatible walled gardens, similar to what AoL of the late 1990s was to the open Internet.
The promise of [XMPP](http://xmpp.org/) was to deliver federated instant messaging: anyone would be able to spin up an IM server capable of exchanging messages with any other XMPP server in the world. Unfortunately XMPP never delivered on this promse. Instant messengers are still a bunch of incompatible walled gardens, similar to what AoL of the late 1990s was to the open Internet.
The goal of this project is to actually deliver on XMPP's original vision: create a modern open platform for federated instant messaging with emphasis on mobile communication. A secondary goal is to create a decentralized IM platform which is much harder to track and block by the governments.
@ -23,13 +23,15 @@ The goal of this project is to actually deliver on XMPP's original vision: creat
## Demo
### Web
### Web
A web demo is usually available at https://api.tinode.co/ ([source](https://github.com/tinode/example-react-js/)). Login as one of `alice`, `bob`, `carol`, `dave`, `frank`. Password is `<login>123`, e.g. login for `alice` is `alice123`. You can discover other users by email or phone by prefixing them with `email:` or `tel:` respectively. Emails are `<login>@example.com`, e.g. `alice@example.com`, phones are `17025550001` through `17025550009`.
A web demo is usually available at https://api.tinode.co/ ([source](https://github.com/tinode/example-react-js/)). Login as one of `alice`, `bob`, `carol`, `dave`, `frank`. Password is `<login>123`, e.g. login for `alice` is `alice123`. You can discover other users by email or phone by prefixing them with `email:` or `tel:` respectively. Emails are `<login>@example.com`, e.g. `alice@example.com`, phones are `17025550001` through `17025550009`.
[Docker images](https://hub.docker.com/u/tinode/).
### Android
[Android demo](https://github.com/tinode/android-example) is mostly stable and functional. See screenshots below. A [debug APK](https://github.com/tinode/android-example/releases/latest) is provided for convenience.
[Android demo](https://github.com/tinode/android-example) is mostly stable and functional. See screenshots below. A [debug APK](https://github.com/tinode/android-example/releases/latest) is provided for convenience.
### Command Line
@ -41,9 +43,9 @@ A text-only [command line client](./tn-cli) implements every possible command.
* User `Tino` is a [basic chatbot](./chatbot) which responds with a [random quote](http://fortunes.cat-v.org/) to any message.
* As generally accepted, when you register a new account you are asked for an email address. The server will send an email with a verification code to that address and you can use it to validate the account. To make things easier for testing, the server will also accept `123456` as a verification code. Remove line `"debug_response": "123456"` from `tinode.conf` to disable this option.
* As generally accepted, when you register a new account you are asked for an email address. The server will send an email with a verification code to that address and you can use it to validate the account. To make things easier for testing, the server will also accept `123456` as a verification code. Remove line `"debug_response": "123456"` from `tinode.conf` to disable this option.
* The demo server is configured to use [ACME](https://letsencrypt.org/) TLS [implementation](https://godoc.org/golang.org/x/crypto/acme) with hard-coded requirement for [SNI](https://en.wikipedia.org/wiki/Server_Name_Indication). If you are unable to connect then the most likely reason is your TLS client's missing support for SNI. Use a different client.
* The demo server is configured to use [ACME](https://letsencrypt.org/) TLS [implementation](https://godoc.org/golang.org/x/crypto/acme) with hard-coded requirement for [SNI](https://en.wikipedia.org/wiki/Server_Name_Indication). If you are unable to connect then the most likely reason is your TLS client's missing support for SNI. Use a different client.
## Features
@ -105,4 +107,4 @@ A text-only [command line client](./tn-cli) implements every possible command.
#### SEO Strings (word 'chat' in Chinese, Russian, and Persian)
聊天室 чат گپ
聊天室 чат گپ

View File

@ -123,8 +123,7 @@ func (fh *fshandler) Download(url string) (*types.FileDef, media.ReadSeekCloser,
file, err := os.Open(fd.Location)
if err != nil {
perr := err.(*os.PathError)
if perr.Err == os.ErrNotExist {
if os.IsNotExist(err) {
// If the file is not found, send 404 instead of the default 500
err = types.ErrNotFound
}