Skip to content

Commit

Permalink
Don't try to set Page::slug() to empty string causing error in slug…
Browse files Browse the repository at this point in the history
… format
  • Loading branch information
rhukster committed May 10, 2016
1 parent eacdea5 commit ad74446
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v1.1.0-beta.5
## 05/xx/2016

1. [](#bugfix)
* Fixed "Invalid slug set in YAML frontmatter" when setting `Page::slug()` with empty string [#580](https://github.com/getgrav/grav-plugin-admin/issues/580)
* Only `.gitignore` Grav's vendor folder
* Fix trying to remove Grav with `GPM uninstall` of a plugin with Grav dependency

# v1.1.0-beta.4
## 05/09/2016

Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Page/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ public function metadata($var = null)
*/
public function slug($var = null)
{
if ($var !== null) {
if ($var !== null && $var !== "") {
$this->slug = $var;
if(!preg_match('/^[a-z0-9][-a-z0-9]*$/', $this->slug)){
Grav::instance()['log']->notice("Invalid slug set in YAML frontmatter: " . $this->rawRoute() . " => ". $this->slug);
Expand Down

0 comments on commit ad74446

Please sign in to comment.