Skip to content
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

Add dead simple API #34

Merged
merged 3 commits into from
Aug 10, 2018
Merged

Add dead simple API #34

merged 3 commits into from
Aug 10, 2018

Conversation

honzajavorek
Copy link
Member

@honzajavorek
Copy link
Member Author

Error: Filename extension of 'index.html' (type text/html) does
not match Content-Type: application/json

Hmmm 🤔

@honzajavorek
Copy link
Member Author

Nechápu? Travis řve nesmysly. Oddebuguju jindy.

@app.route('/favicon.ico')
def favicon():
static = os.path.join(app.root_path, 'static')
return send_from_directory(static, 'favicon.ico',
mimetype='image/vnd.microsoft.icon')
return send_from_directory(static, 'favicon.ico', mimetype='image/x-icon')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the Internet Assigned Numbers Authority (IANA), all .ico file falls under the MIME type image/vnd.microsoft.icon which is what Travis tells you anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I understood the error message the other way around 🤦‍♂️ Thanks for the help!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(my comment in 029dad2 being a proof 😄 )

Copy link
Member

@hroncok hroncok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd appreciate a clickable link in footer. Otherwise (except the icon mime type), it looks good.

@honzajavorek
Copy link
Member Author

So locally I get following with the new setup:

Error: Filename extension of 'favicon.ico' (type image/x-icon) does not match Content-Type: image/vnd.microsoft.icon

The previous setup passed fine locally, but blew up on CI. So is this Linux vs macOS thing?!

@honzajavorek
Copy link
Member Author

honzajavorek commented Aug 9, 2018

So now it passes on CI, but it probably isn't portable to macOS ¯\_(ツ)_/¯ Not such an issue as it all works with serve, only freeze has the error and I don't need freeze locally.

Ready for a re-review. Feel free to merge if it feels ok.

@encukou
Copy link
Member

encukou commented Aug 10, 2018

It could also be a difference in Python or Flask versions. Elsa is quite picky here (for good reasons actually, but sometimes unfortunately things break.)


@app.route('/api.json')
def api_redirect():
return redirect(url_for('api', lang=detect_lang(request)))
Copy link
Member

@encukou encukou Aug 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't actually work for a static page – the language is selected at build time.
You're aware of that, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. :)

@hroncok
Copy link
Member

hroncok commented Aug 10, 2018

Could you rebase the mime change there and back not to be here?

lang detection won't work for a static site - #34 (comment)
let's assume most visitors understand Czech
@honzajavorek
Copy link
Member Author

@encukou @hroncok final blessing?

@honzajavorek honzajavorek merged commit 318730a into master Aug 10, 2018
@honzajavorek honzajavorek deleted the honzajavorek/api branch August 10, 2018 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants