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

⚡️ Throw clear error message when config.url has no protocol #8466

Merged
merged 2 commits into from
May 21, 2017

Conversation

aileen
Copy link
Member

@aileen aileen commented May 17, 2017

closes #8449

Fixes an issue where Ghost would crash when the URL in config is set up without a protocol.
This PR checks the URL on startup within config utils and outputs a warning for the user, but also sanitises the URL to prevent crashes.

Not sure, if this is the wanted behaviour in this case. We could also prevent Ghost from starting and output a more clear error message instead... Let me know, what you'd prefer @kirrg001

@aileen aileen requested a review from kirrg001 May 17, 2017 04:32
closes TryGhost#8449

Fixes an issue where Ghost would crash when the URL in `config` is set up without a protocol.
This PR checks the URL on startup within config utils and outputs a warning for the user, but also sanitises the URL to prevent crashes.
@aileen aileen force-pushed the sanitise-urls-without-protocol branch from b111720 to 7f1eb17 Compare May 17, 2017 05:38
} else {
this.set('url', 'http://' + url);
console.log(chalk.red('Watch out! Your URL in the config should have a protocol! E.g. "http://my-ghost-blog.com"'));
console.log(chalk.white('Current URL: ') + chalk.cyan(url));

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@kirrg001 kirrg001 self-assigned this May 18, 2017
@aileen aileen changed the title ⚡️ Accept URL in config without protocol ⚡️ Throw clear error message when config.url has no protocol May 18, 2017
closes TryGhost#8449

Preventing Ghost from starting, if `config.url` is set up without protocol, eg. `localhost:2368` instead of `http://localhost:2368` and throwing a more clear error message.
@aileen aileen force-pushed the sanitise-urls-without-protocol branch from 0492337 to 5f9d918 Compare May 18, 2017 10:49
Copy link
Contributor

@kirrg001 kirrg001 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

If we feel like we want to add the protocol and start Ghost, we can change the behaviour anytime. But for now, it works similar to the CLI!

@kirrg001 kirrg001 merged commit c7bbaff into TryGhost:master May 21, 2017
@aileen aileen deleted the sanitise-urls-without-protocol branch October 13, 2017 08:34
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.

🐛 server crashes if blog url has no protocol
2 participants